I'm trying to write a grammar for various time formats (12:30, 0945, 1:30-2:45, ...) using ANTLR. So far it works like a charm as long as I don't type in characters that haven't been defined in the grammar file.
I'm using the following JUnit test for example:
final CharStream stream = new ANTLRStringStream("12:40-1300,15:123-18:59"...
Hey,
Does anyone know anything about how Antlr works? I'm getting an error on a dev server:
[NullReferenceException: Object reference not set to an instance of an object.]
Antlr.StringTemplate.CommonGroupLoader.LocateFile(String filename) +19
Antlr.StringTemplate.CommonGroupLoader.LoadGroup(String groupName, StringTemplateGroup s...
Hi,
I am trying to implement a nested comment in D.
nestingBlockComment
: '/+' (options {greedy=false;} :nestingBlockCommentCharacters)* '+/' {$channel=HIDDEN;}; // line 58
nestingBlockCommentCharacters
: (nestingBlockComment| '/'~'+' | ~'/' ) ; //line 61
For me, it would be logical that this should work...
This is the error...
I’m trying to build a grammar that interprets user-entered text, search-engine style. It will support the AND, OR, NOT and ANDNOT Boolean operators. I have pretty much everything working, but I want to add a rule that two adjacent keywords outside of a quoted string implicitly are treated as in an AND clause. For example:
cheese and ...
I was having difficulty figuring out what does ^ and ! stand for in ANTLR grammar terminology.
...
What is the best strategy of making Abstract Syntax Trees serializable to an XML File?
...
the 'expr' rule in the ANTLR grammar below obviously mutually left-recursive. As a ANTLR newbie it's difficult to get my head around solving this. I've read "Resolving Non-LL(*) Conflicts" in the ANTLR reference book, but I still don't see the solution. Any pointers?
LPAREN : ( '(' ) ;
RPAREN : ( ')' );
AND : ( 'AND' | '
OR : ( 'OR' | ...
Is there a tool for converting an ANTLR grammar to a Bison grmmar?
...
Hi!
I am currently servicing an old VBA (visual basic for applications) application. I've got a legacy tool which analyzes that application and prints out dead variables. As there are more than 2000 of them I do not want to do this by hand.
Therefore I had the idea to transform the separate codefiles which contain the dead variable acc...
I get a mismatched set exception when I try to parse "abc" (the quote marks are part of the input)
Here is the (simplified) grammar - pretty much verbatim from the Java.g example and basically the same from other example grammars. Is there some bug in the latest version? Using 3.2 in the context of eclipse.
Thanks in advance.
grammar ...
Is the following even possible? I want to "reverse" the input given to antlr and make each token a child of the previous one.
So, for the input (Assume each token is separated by the '.' char) :
Stack.Overflow.Horse
I would like my grammar to produce the following AST:
Horse
|---Overflow
|---Stack
So far, I've managed ...
I've been using the ANTLR supplied ECMAScript grammar with the objective of identifying JavaScript global variables. An AST is produced and I'm now wondering what the based way of filtering out the global variable declarations is.
I'm interested in looking for all of the outermost "variableDeclaration" tokens in my AST; the actual how-t...
I'm trying to match measurements in English input text, using Antlr 3.2 and Java1.6. I've got lexical rules like the following:
fragment
MILLIMETRE
: 'millimetre' | 'millimetres'
| 'millimeter' | 'millimeters'
| 'mm'
;
MEASUREMENT
: MILLIMETRE | CENTIMETRE | ... ;
I'd like to be able to accept any combinat...
I'm attempting to parse one particular (home grown) JavaDoc tag in my JavaScript file and I'm struggling to understand how I can achieve this. Antlr is complaining as documented below:
jsDocComment
: '/**' (importJsDocCommand | ~('*/'))* '*/' <== See note 1
;
importJsDocCommand
: '@import' gav
;
gav
: gavGroup ':...
I've created a antlr grammar using AntlrWorks, and have created a localization tool for internal use. I would like to convert unicode escape sequences into the actual Java character while parsing, but am unsure of the best way to do this. Here are the token definitions in my grammar. Is there some way to specify an action for the fra...
I want to create a token from '..' in the ANTLR3 lexer which will be used to string together expressions like
a..b // [1]
c .. x // [2]
1..2 // [3]
3 .. 4 // [4]
So, I have added,
DOTDOTSEP : '..'
;
The problem is that I already have a rule:
FLOAT : INT (('.' INT (('e'|'E') INT)? 'f'?) | (('e'|'E') INT)? ('...
hi,
i have a problem setting/getting the right return values in my antlr grammar.
I tried:
expressionExp returns [String ref]
: Number {$ref = null; }
| ident=Identifier {$ref = $ident.text;}
| '(' innerExpressionExp ')'
;
.. and thought if it now have somethin like
ref=expressionExp
i get a null if i match a number and th...
Hello!
I have written an ANTLR 3 grammar for parsing TaskJuggler III bookings files (see below).
On line
project prj "Sample project" "1.0" 2010-10-24-00:00-+0200 - 2010-11-23-09:00-+0100 {
I'm getting following errors:
line 1:42 mismatched character '-' expecting set '0'..'9'
line 1:48 mismatched character ':' expecting...
I'm trying to create ANTLR parser for Lua. So i took grammar produced by Nicolai Mainero(available at ANTLR's site, Lua 5.1 grammar) and begin to work.
Grammar is good. One thing not working: LONG STRINGS.
Lua specification rule: Literal
strings can also be defined using a
long format enclosed by long brackets.
We define an op...