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

Is it possible to construct an Yylex object by using an String?

Recently i've been working with Jflex and i noticed that when i try to construct the Yylex object it only accepts java.io.Reader and java.io.InputStream. How could i do if i just want to build the object by using only a String?, like this: String…
mayhem
  • 39
  • 3
  • 9
0
votes
1 answer

JFlex Error: Unexpected character: YYINITIAL

I'm trying to use JFlex with the following input file: %class Lexer %line %column %init{ yybegin(YYINITIAL); %init} %{ Copied directly to Java file. %} delim = \r|\n|\r\n not_newline = . whitespace = {delim} | [ \t\n\r] any …
Rachel
  • 1
  • 3
0
votes
1 answer

JFlex - how to test the scanner

I've just started to learn JFlex. I am studying one of the official Jflex examples, which is a scanner for the Java language. In the Readme file it says: The scanner (without parser attached) can be test with: java TestLexer But when I…
phil
  • 255
  • 4
  • 16
0
votes
1 answer

JFLEX installation error

I am trying to install JFLEX on my windows 8 64-bit desktop, in order to do some university coursework. I have downloaded the files and then performed the following steps: Opened the batch file named JFLEX, at the following address:…
user2970105
0
votes
2 answers

JFlex and NUL characters

Does anybody know how to handle '\0' in java JFlex?? I tried encoding as a regular expression to be matched like \0 { /* DO nothing */ } but it did not work. The documentation does not provide any information. The reason I need this is because I am…
leco
  • 1,989
  • 16
  • 30
0
votes
1 answer

Jflex capturing match

I'm using JFlex and i want to match something like: |MATCHED|NOTMACHED| |NOTMACHED|NOTMACHED|NOTMACHED| |MATCHED|NOTMACHED| |NOTMACHED|NOTMACHED|NOTMACHED| my pattern: FIXTURE_NAME_PATTERN=[^\|]\n\|[A-Za-z]+\|
smajlo
  • 972
  • 10
  • 21
0
votes
1 answer

How to create regex to match "String""" as two strings

I need to match "String""" as two strings. I'm using this for my school project (Lexer implementation) and I'm having a problem with situation when I get something like "Something""" being matched as one string Something"" Thank you guys in…
Nikola Milutinovic
  • 731
  • 1
  • 8
  • 23
0
votes
1 answer

Suitable input type for java bytecode generator in asm lib

Creating a java compiler. Using jflex - lexical analysis, cup - parsing and asm- bytecode generation. jlex output is a scanner object. We create a parser object to do the parsing. What should we pass to the bytecode generation. Is there any bytecode…
0
votes
3 answers

Vowel regexp in jflex

So I did an exercise using jflex, which is about counting the amount of words from an input text file that contains more than 3 vowels. What I end up doing was defining a token for word, and then creating a java function that receives this text as…
rdk1992
  • 406
  • 1
  • 5
  • 20
0
votes
1 answer

JFlex regex vs keywords in lexical rules

What's the point in allowing the use of both keywords and regexes in the section covering lexical rules in a JFlex input file? It seems retrieve { action code} ...and "retrieve" { action code } ... both match an input containing "retrieve", the…
fast-reflexes
  • 4,891
  • 4
  • 31
  • 44
0
votes
1 answer

Generating Java Sources with sbt JFlex plugin

I am pulling my hair using the sbt-jflex plugin to generate Java sources via JFlex, before the main javac phase of sbt (0.12). The plugin is a clone of the ANTLR plugin, and I found this question which shows how to use the latter. So I have the…
0__
  • 66,707
  • 21
  • 171
  • 266
0
votes
1 answer

Character transformation rules in Lucene and\or JFlex

I am new to Lucene, do not have enough time to go through the entire documentation. We are using Lucene highlighter to highlight matches. As far I know Lucene itself is using JFlex engine for it. Current task requires introduction of new language…
Ihor M.
  • 2,728
  • 3
  • 44
  • 70
0
votes
3 answers

Matching the identifiers with strings, digits and _

[a-zA-Z]_*[a-zA-Z0-9]* which I'm aiming for to match : astring_something; helloall90 but not : Astring _helloall My regex is protecting me with the identifiers should start with small case letters. But it doesn't work for _ cases. Passing the…
sriram
  • 8,562
  • 19
  • 63
  • 82
0
votes
3 answers

Trying to match up strings in ""

"[a-zA-Z0-9]*" which I wish to match the pattern of the form "testing" But my regex is not matching any of these strings. Where I'm making the mistake? Thanks in advance.
sriram
  • 8,562
  • 19
  • 63
  • 82
0
votes
1 answer

Optional JFlex lookahead with End of File

I'm attempting to write a lexer for Fitnesse using JFlex and am having trouble with WikiWords (http://fitnesse.org/FitNesse.UserGuide.WikiWord) I copied over the regex linked and am using the following regex for tokens: . …