Questions tagged [re2c]

re2c is a c++ tool for writing fast and flexible scanners.

14 questions
4
votes
1 answer

RE2C How to discard current matched rule and keep trying?

Can a rule be conditionally discarded after being matched and continue to try other rules with lower precedence? {rule} { if(condition) { return TOKEN; } // discard // continue and try the other rules…
marcio
  • 10,002
  • 11
  • 54
  • 83
4
votes
3 answers

re2c scanners on C++ iterator source

I am attempting to use re2c with input defined with an iterator pair instead of a null terminated string. From Manual: YYCURSOR [...] On entry, YYCURSOR is assumed to point to the first character of the current token. On exit, YYCURSOR will point…
JonT
  • 502
  • 4
  • 13
3
votes
1 answer

Is there a good working tutorial on re2c + lemon?

I've tried a couple. And there is only a couple of tutorials in Google for re2c+lemon. Currently for all examples I get similar bunch of errors like: In file included from main.cpp:2:0: parser.y:44:5: error: ‘yygotominor’ was not declared in this…
Sergey
  • 19,487
  • 13
  • 44
  • 68
3
votes
1 answer

YYSETSTATE how to know the identifier of YYFILL?

The manual clearly says: YYSETSTATE (s) [...] The parameter to YYSETSTATE is a signed integer that uniquely identifies the specific instance of YYFILL (n) that is about to be called. [...] The problem is, I'm calling my YYSETSTATE defined macro…
marcio
  • 10,002
  • 11
  • 54
  • 83
2
votes
1 answer

Syntax error from default rule "*"

When compiling (processing using re2c) the sample Recognizing integers: the sentinel method I get: re2c : error : line 16, column 9: syntax error It seems to be complaining about the "*". The following is my 01_recognizing_integers.re file (except…
Sam Hobbs
  • 2,594
  • 3
  • 21
  • 32
2
votes
1 answer

Using re2c with ISO-8859-x

We have some text in ISO-8859-15 for which we want to tokenize. (ISO-8859-15 is ISO-8859-1 with the Euro sign and other common accented characters, for more details see ISO-8859-15). I am trying to get the parser to recognize all the characters. The…
Yimin Rong
  • 1,890
  • 4
  • 31
  • 48
1
vote
1 answer

Lemon parser token value with void * type

I was trying to use void* type for my lemon parser but I got some weird problem. Initially I used a custom token type, a struct to hold the values of token, then I switched to void* because my token value types vary. Here is some of my parser…
Arif Balik
  • 115
  • 1
  • 9
1
vote
1 answer

How to Install re2c on Linux Centos 7

I was trying to install the Mailparse PECL extension with WHM/cPanel and it kept failing because re2c was missing.
Jonathan Roy
  • 903
  • 11
  • 20
1
vote
2 answers

Detecting IP address in RE2C

I am trying to write a regex to detect IP addresses and floating point number in re2c (http://re2c.org/). Here is the regex I am using [-+]?[0-9]+[.][0-9]+ { RETURN(FLOAT); }
sushil
  • 165
  • 1
  • 9
1
vote
1 answer

match beginning of line with re2c

i'm using re2c 0.10.5 and i can't match beginning of string properly. For example, I defined: [aA] w "=" { return ATTRKEYWORD;} [bB] w "=" { return BWKEYWORD;} where w is defined as: w = s*; but if i've the string…
junky
  • 336
  • 2
  • 7
1
vote
1 answer

using YYLIMIT in re2c

Thank you in advance! I'd like to implement a code to analysis ipv4 address format such as "192.168.0.0". So, I did like this. #include #include typedef struct qppLexerObj { char *mCursor; char *mLimit; char…
user3795944
0
votes
0 answers

Homebrew install: PHP dependency re2c can't find Python interpreter

I broke my PHP installation on MacOS Mojave, so I'm trying: brew reinstall shivammathur/php/php@7.4 This goes well until reaching re2c: ==> Installing shivammathur/php/php@7.4 dependency: re2c which fails with: checking for a Python interpreter…
gl03
  • 1,109
  • 12
  • 18
0
votes
1 answer

re2c: syntax error when trying to match string

I'm trying to use re2c, but it gives me a syntax error on this regex: (["'])((\\{2})*|(.*?[^\\](\\{2})*))\1 What's wrong with it? This should match a doubly quoted or single quoted string
Astavie
  • 91
  • 1
  • 8
0
votes
1 answer

How to match whitespace and comments with re2c

I started very recently to use bison for writing small compiler exercises. I am having some issues with white spaces ans comments. I was trying to debug the problem and I arrived to this source that looks like what I am looking for. I tried to…
Emanuele
  • 2,194
  • 6
  • 32
  • 71