Code Monkey home page Code Monkey logo

Comments (3)

yaoyx108 avatar yaoyx108 commented on May 29, 2024

Attached is the full jflex file.

from jflex.

yaoyx108 avatar yaoyx108 commented on May 29, 2024

minijava.jflex.txt

GitHub only accepts files with certain extension. I've added .txt.

from jflex.

lsf37 avatar lsf37 commented on May 29, 2024

This does indeed look like a bug, thanks for reporting it. But it's mostly a bug in error reporting (sorry :-)). Enabling the use of macros in character classes like [..] seems to have uncovered a whole bunch of combinations that aren't properly rejected.

In this case, {white} is a full regular expression (.. | ..), not itself a character class, so it can't be used inside the [..].

For fixing your specific problem, it looks like you might be wanting just ({white}|.) instead of [{white}|.]. That said, this is equivalent to just [^] (any character, including newline).

On the danger of doing your homework for you, there is a pitfall with this: "/*" [^]* "*/" will not quite match a slash-star comment. E.g. it will match all of /* abc */ return x; /* abc */ in one go, because JFlex will always give you the longest possible match.

The expression you'd need is "/*" followed by any string that is not "*/", followed by "*/". There is a special operator for this in JFlex (not present in usual regexp engines). You can write: "/*" ~"*/"

from jflex.

Related Issues (20)

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.