Giter VIP home page Giter VIP logo

leex's Issues

regex supporting problem

Erlang Version: R18.3

when i use this regex in leex(*.xrl):

\/\*(\*(?!\/)|[^*])*\*\/

i got this error:

 bad regexp `illegal character ?'

lazy pattern matching

Hello,

I would like to usw leex in conjunction with yecc on a compiler project of mine.

I am sorry to bother you with this but I encountered a Problem, when trying to parse c-style comments, e.g.,

/* my comment */

as a Single token. The delimiters are not single characters, so a pattern like "[^"]*" as would work for strings doesn't work here.

Instead, lazy (ungreedy) pattern matching would be necessary. Unfortunately, a lazy pattern like

/\*.*?\*/

has not worked.

I am aware, that lazy pattern matching is not a standard feature of a lexer and that I can circumvent this problem by using multiple lexers (see http://flex.sourceforge.net/manual/Why-doesn_0027t-flex-have-non_002dgreedy-operators-like-perl-does_003f.html) but it feels like I am missing something. Especially since the re package for erlang regexes supports lazy patterns (see http://www.erlang.org/doc/man/re.html and https://arifishaq.wordpress.com/2013/11/13/playing-with-regular-expressions/).

If there is any way to lex the input string in a single pass with a single lexer I would appreciate your input.

Best regards
Jörgen

Parametrized xrl file ?

How to declare for instance a tokenizer where separators are declared in beginning of file to parse ?
I think to EDIFACT or ANSI X12 EDI files where separators are declared in beginning.
It could be nice to pass value of a macro while running lexer, or a syntax to pick characters in some position or catching ereg on file itself, instead having to do templates to generate xrl file and compile at runtime.

regex for regex in leex

in stackoverflow i found a regex for regex:

/^((?:(?:[^?+*{}()[\]\\|]+|\\.|\[(?:\^?\\.|\^[^\\]|[^\\^])(?:[^\]\\]+|\\.)*\]|\((?:\?[:=!]|\?<[=!]|\?>)?(?1)??\)|\(\?(?:R|[+-]?\d+)\))(?:(?:[?+*]|\{\d+(?:,\d*)?\})[?+]?)?|\|)*)$/

but leex doesnt support ^and$ in match rules, is there anyway else to doing this ?

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.