Questions tagged [jflex]

JFlex — The Fast Scanner Generator for Java. JFlex is a flex-like lexer generator for Java.

JFlex is a lexical analyzer generator (also known as scanner generator) for Java, written in Java. It is also a rewrite of the very useful tool JLex which was developed by Elliot Berk at Princeton University. As Vern Paxson states for his C/C++ tool flex: They do not share any code though.

JFlex is designed to work together with the LALR parser generator CUP by Scott Hudson, and the Java modification of Berkeley Yacc BYacc/J by Bob Jamison. It can also be used together with other parser generators like ANTLR or as a standalone tool.

Related Links:

196 questions
0
votes
1 answer

How to get text between special tags using jflex

I have special tag as "{code}". I need to get some text between two of those tags using jflex. I am trying to use following regex for it CODE_BLOCK= "{code}"(.*?)"{code}" The problem is that it always returns text between only first an last tags.…
0
votes
0 answers

JFlex. Help writing a simple parser to extract numbers

I have some samples data extracted from a PDF and I need to write a parser to extract the text and numbers in an array for further manipulation. I think I should use JFlex but have no idea how to start The data looks like that Manager Salary…
Pascal DeMilly
  • 681
  • 1
  • 6
  • 16
0
votes
0 answers

Regular Expression matching RANGE of HH:MM:SS

So I am trying to find a smart way of writing down how to recognise this particular range of time: HOUR: an hour with the formats HH:MM or HH:MM:SS and values between 08:31:12 and 23:21:10 (correct examples are: 08:31, 23:21:09, 12:54:51) Do…
0
votes
1 answer

Tokenize Timestamp with jFlex and handle ISO format

I am trying to solve an date tokenization issue with various date format, and one of them maybe in ISO8601 format, which using a 'T' as a delimiter. And I want to be able to know character 'T' is a timestamp when it has a digit preceding and…
SY Z
  • 53
  • 3
  • 10
0
votes
1 answer

Regex to match string literal with newline and carriage return

I'm having difficulty with matching a string literal with both newline(\n) and carriage return(\r) characters. For example: "132 Holt Court, Cashtown, Rhode Island, 7680 \n\r" What I tried is \"([^\\\"]|\\.)*\" But this regex can only match the…
Minh Thai
  • 568
  • 6
  • 18
0
votes
1 answer

Linking CUP and jflex

I am trying to link my parser.java and yylex.java using help from http://www2.cs.tum.edu/projects/cup/examples.php http://www.cs.princeton.edu/~appel/modern/java/CUP/manual.html http://jflex.de/manual.html But I am getting these errors. error:…
uutsav
  • 389
  • 5
  • 16
0
votes
3 answers

Install JFLEX ON MAC

Can someone tell me how I can install jflex (The Fast Scanner Generator for Java) on my Mac? I searched everywhere on google and I can't find it. Can you help me ?
Basuz93
  • 19
  • 2
0
votes
1 answer

recognize fractional numbers in JFlex 1.4.3

in my SL.lex file i have this regular expression for fractional numbers: Digit = [1-9] Digit0 = 0|{Digit} Num = {Digit} {Digit0}* Frac = {Digit0}* {Digit} Pos = {Num} | '.' {Frac} | 0 '.' {Frac} | {Num} '.' {Frac} PosOrNeg = -{Pos} | {Pos} Numbers…
kitsuneFox
  • 1,243
  • 3
  • 18
  • 31
0
votes
1 answer

RSyntaxTextArea Custom Language JFlex

I'm trying to use JFlex to add custom language highlighting to RSyntaxTextArea. However, the moment I type a character I get an Index Out of Bounds Exception: http://pastie.org/private/ygjyj4y5nludeu3dn1xug This occurs even if I use the example…
0
votes
1 answer

JFlex: How can I let yytext continue during matching

I am trying to write a lexer for an IntelliJ language plugin. In the JFLex manual there is an example that can lex string literals. However in this example they use a StringBuffer to insert each part of the lexed characters and continually build up…
lanoxx
  • 12,249
  • 13
  • 87
  • 142
0
votes
3 answers

Java CUP and JFlex Interaction

I am considering to use the CUP parser generator for a project. In order to correctly parse some constructs of the language I am going to be compiling, I will need the lexer (generated by JFlex) to use information from the symbol table (not parse…
0
votes
1 answer

Lexer for CAD NC programs

I'm evaluating the possibilities to track tool movement using nc programs in different formats as input. Using a lexer to tokenize the different program types into a meta layer, where only uniform tools and points, etc. exist seemed like a good…
mike
  • 4,929
  • 4
  • 40
  • 80
0
votes
1 answer

error in building ast using byaccj

I am using jflex and byaccj to build an AST. I am unable to resolve the error and I have used type casting but the error persists for the following rule in the grammar: program : CLASS Program '{' field_decl '}' { program1 $$ =…
user1683894
  • 405
  • 1
  • 6
  • 20
0
votes
1 answer

Parsing a text with Byacc

Higuys, I want to parsing a text using Byacc. The text is made clearly by spaces and new line. What do you think about these rules to parse one text? text: /* empty string */ {$$ = "";} |TEXT {$$ = $1;} |TEXT whitespace text {$$ = $1 +…
0
votes
1 answer

How to use "\S" in jflex(flex) lexer?

I want to match non-space characters, so I defined flex file with JFlex: %% Value = [\S]+ %% {Value} { return MyTokens.Value; } . { return MyTokens.BadCharacter; } Then I try the generated java code to analyse the string "abc", but I…
Freewind
  • 193,756
  • 157
  • 432
  • 708