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

JFLEX: create custom function to count number of characters

I have a project to write a lexer using JFLEX for a made up language.It is a language with a simple syntax including simple variables like strings and characters integers and floats. However i have a problem with characters. I created a state…
0
votes
1 answer

Accessing command line arguments from eof with JFLEX

Im writing a small lexical analyzer which needs to write some outputs to a file. Once Im done scanning im creating an output file PrintWriter writer = new PrintWriter(args[0].substring(0,4)+"output.txt"); So essentially im trying to use the prefix…
Mitch
  • 3,342
  • 2
  • 21
  • 31
0
votes
1 answer

String or number to Character with jflex

I'm using jflex and i have to recognize characters, which can be: Normal chars, like 'a' Numbers, like '\126' I've made this regular expression (Integer is a macro already defined): Character = (\'.\')|(\'\\{Integer}\') I don't know if it's…
novayhulk14
  • 113
  • 11
0
votes
1 answer

Regular expression containing all the text but a certain regular expression

I come from here Regex: match everything but But they only say how to get a Regex containing all but some string. What im trying to do is finding a regular expression that matches me all the text but this ^([\S+" "?]+" "@[a-zA-Z0-9_]{1,15})$ (or any…
Guillem
  • 144
  • 4
  • 13
0
votes
0 answers

java_cup.runtime.Symbol "EOF" has not been declared

I have alreay read this discussion, but it didn't help me. start with file; file ::= primario SEP secondario SEP terziario EOF {:fm.scriviDebug();:}; Where fm.scriviDebug() is a my custom class that prints on stdout what CUP parsed. I have no idea…
shogitai
  • 1,823
  • 1
  • 23
  • 50
0
votes
1 answer

Translating a Pygments regexp to JFlex

I'm trying to build a lexer for Markdown in JFlex; I'm looking at the source for Pygments: For example, this is the rule for horizontal rule: (r'^\s*\n(?:\s*[-*_]){3,}\s*\n', Markdown.Markup) I'm naïvely writing this in my .flex…
0__
  • 66,707
  • 21
  • 171
  • 266
0
votes
1 answer

How to solve an unknown syntax error in parser?

I'm trying to parse this piece of code which is written in my desired grammar and i get syntax error everytime. I've checked my code more than 10 times and i could'nt find a solution. The PARSER and LEXER codes are generated by bison and jflex…
hexpheus
  • 741
  • 10
  • 22
0
votes
1 answer

JFlex license for old Joomla site

i moved an 10 years old joomla site on a local php 5.2 server to rescue some of the content. If i run the site, the only content it shows is: "JFlex Images FULL was not licensed for this domain." Is there any way to safe remove these extension or…
goh
  • 27
  • 5
0
votes
1 answer

JFLEX Error: Syntax Error @ Symbol: ID (...) Error: Illegal use of reserved word

I have the following .flex file: package mini_c; import java_cup.runtime.*; import static mini_c.sym.*; %% %class Lexer %unicode /* The characters are unicode */ %cup /* Syntax analyser with cup (Parser part)…
J Agustin Barrachina
  • 3,501
  • 1
  • 32
  • 52
0
votes
2 answers

Regex syntax for support q/k/kdb+ comment using JLexer

Q: What do I need using for my lexer logic? Only regex or maybe special functions of lexer? Where does the mistake in my syntax for q multi-comment? Details: I'm trying to write intellij idea plugin for k/q/kdb+ (wiki, q/kdb+), and my plugin based…
Alykoff Gali
  • 1,121
  • 17
  • 32
0
votes
0 answers

JFlex + byaccj exercise's not working correctly

First of all, sorry for my bad English but I'm not native. I'm studying jflex and byaccj at university and I've done a simple exercise to learn how things work. I've a test.xml file like this: My…
0
votes
1 answer

JFlex Lexer that distinguishes "Class brackets" and "Method bracket"

I need to write a lexer for a java source code plagiarism detector. Here is an example what I want to achieve. //Java code Tokens: public class Count { Begin Class public static void…
F. Zhao
  • 13
  • 4
0
votes
2 answers

Can't run jflex.bat in windows 8.1

I just made the installation of jflex and cup and I want to test if everything is ok. Here is what I write in the shell and the result I get. Here is the content of jflex.bat file: Is there something I have done wrong? How to run for first time…
John Dow
  • 47
  • 2
  • 7
0
votes
1 answer

Brace matcher using JFlex

I'm writing an IntelliJ plugin. One of the functionalities should be a brace matcher. I already did the plugin tutorial from JetBrains. And I also got the brace matcher working with this regular expression [^@\*\{\}\(\)\$\.]* so everything is…
CrustyCheese
  • 49
  • 1
  • 5
0
votes
0 answers

initializing a class in my lexical analyzer in java

I'm trying to make a lexical analyzer with jflex and java files but I'm getting an error when I try to compile MphpLex.java I'm using material from a clite analyzer in one of my classes. Below I will post the code, how I'm compiling and the error…