Coder Social home page Coder Social logo

scrall's People

Contributors

modelint avatar

Stargazers

 avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

scrall's Issues

Exclude keywords

Discussed in #5

Originally posted by lelandstarr January 11, 2022

//ignore_keywords = (

//ignore_keywords = (
//    !" true" !"true " !" false" !"false "
//    !" and" !"and " !" or" !"or "!" not" !"not "
//    !" its" !"its " ! " me" !" me"
//)
word = r'[A-Za-z][A-Za-z0-9]*'
//word = ignore_keywords r'[A-Za-z][A-Za-z0-9]*'
name = word (NAME_GLUE word)* // One word or a sequence of delimited words (name used for most model elements)

if you attach the negative lookahead to WORD rather then name, it will catch the keywords AS words. This way you do not have to worry about white space.

I have this working in java and have checked that python also has the same negative lookahead syntax.

//Here is word as allowed_word with the keyword exclusion.
allowed_word = r'(?!(true|false|and|or|me|its|not))[A-Za-z][A-Za-z0-9]*'

// and then name would still be
name = allowedword (NAME_GLUE allowedword)* 

```</div>

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.