Hi all,
I seem to remember that the `..` operator inside parser rules matches
token ranges. For example:
grammar T;
parse : A..C;
A : 'a';
X : 'x';
C : 'c';
D : 'd';
The `parse` rule would match the tokens A, X or C. (Needless to say, I'd
never use it in this way, but I thought it was
Hi Franck,
On Sat, Nov 26, 2011 at 8:54 AM, franck102 franck...@yahoo.com wrote:
The grammar below won't compile, this looks like a bug to me?
...
No bug, syntactic predicates and rule parameters can't be mixed. You can
use rule scopes instead:
-
grammar
On Sat, Nov 26, 2011 at 9:58 AM, franck102 franck...@yahoo.com wrote:
In fact the tree has been constructed by the leading (ID-ID),
That tree only exists inside your parenthesis, AFAIK. You can't reference
it outside it (well, you can, but it will be `null`).
So here is exactly what I am
Hi Franck,
On Fri, Nov 25, 2011 at 9:47 PM, franck102 franck...@yahoo.com wrote:
...
containOperator : CONTAINS_TEXT | CONTAINS_MATCH
CONTAINS_TEXT
: 'contains' WS+ ( 'match' { $type=CONTAINS_MATCH }
| 'text' )
;
//
On Fri, Nov 25, 2011 at 9:54 PM, Bart Kiers bki...@gmail.com wrote:
...
-
tokens {
CONTAINS_MATCH;
}
...
CONTAINS_TEXT
: 'contains' WS+ ( 'match' CONTAINS_MATCH
| 'text' )
;
...
fragment CONTAINS_MATCH
Hi Rampon,
On Wed, Nov 23, 2011 at 10:54 AM, Rampon Jerome ramponjer...@yahoo.frwrote:
...
it complained on output option to be AST.
If I add it in my grammar options if complains and still return error
It seems it automatically adds if not there but later on still return
error ???
Is
Hi Bill,
On Wed, Nov 23, 2011 at 5:41 PM, Bill Andersen bill.ander...@mac.comwrote:
Hi Folks...
Been trying to figure out how to shut off default Lexer behavior to print
messages to System.err, such as:
line 2:4 no viable alternative at character ' '
Instead, I'd like to catch
On Fri, Nov 18, 2011 at 7:55 AM, David Riddle da...@mcgilly.com wrote:
Hi -
This should be a very simple thing - I'm attempting to have my grammar hide
newline, carriage returns, etc. However, every concievable form of a
grammar that attempts to skip over these things or send them to the
On Fri, Nov 18, 2011 at 12:39 PM, franck102 franck...@yahoo.com wrote:
I am writing a grammar for a fairly complex expression language, and in
particular I need to support string concatenation which is performed simply
by separating string literals with a space; and which automatically
On Fri, Nov 18, 2011 at 4:01 PM, David Riddle da...@mcgilly.com wrote:
Hi Bart -
Yes, it's a \n, and I thought I told the grammar to set '\n' to a hidden
channel. So, why is it not hidden?
Assuming you mean a new line char, then it _is_ being sent to the HIDDEN
channel as Norman already
On Thu, Nov 17, 2011 at 9:14 AM, D. Frej dieter_f...@gmx.net wrote:
Hi,
I build the following grammar with antlrworks:
grammar questionmark;
horef
:'\?' ('a'..'z')
;
antlrworks tells me check grammar succeeded. However, debugging does not
works because the generated code
On Thu, Nov 17, 2011 at 10:14 AM, D. Frej dieter_f...@gmx.net wrote:
and still: the compilation error stays even if I do not quote the
question mark
Ah, hold on, you're using the `..` (range) operator inside a parser rule
(horef). Either create a lexer rule matching '?' 'a'..'z':
Horef
Hi John,
On Tue, Nov 15, 2011 at 11:46 PM, John B. Brodie j...@acm.org wrote:
Greetings!
...
I do not think you want to recognize floating point values in the
parser. any tokens you send to the HIDDEN $channel (or skip();) will be
silently accepted before and after the '.' of the float.
Hi,
On Wed, Nov 16, 2011 at 8:21 PM, Jarrod Roberson jar...@vertigrated.comwrote:
actually thanks to Bart I need the FLOAT rule as a parser rule with the
predicate because I want to be able to match
But John raises a valid point that I didn't mention: by promoting such a
rule to a parser
On Wed, Nov 16, 2011 at 8:38 PM, Bart Kiers bki...@gmail.com wrote:
Hi,
On Wed, Nov 16, 2011 at 8:21 PM, Jarrod Roberson
jar...@vertigrated.comwrote:
actually thanks to Bart I need the FLOAT rule as a parser rule with the
predicate because I want to be able to match
But John raises
On Wed, Nov 16, 2011 at 8:45 PM, Jarrod Roberson jar...@vertigrated.comwrote:
Or even the input: 123 /* some comments */ . /* more comments */ 5
would
be a valid `number`... :)
Is there a way to support both
a - 1.
b - 1.1.
in a pure lexer rule then, I didn't think there was?
See
On Sun, Nov 13, 2011 at 6:59 PM, Jiwon Seo seoji...@gmail.com wrote:
Thanks for the reply!
I'm trying to do it without extending lexer since I think my
definition of FLOAT should not be a problem with the range operator.
But it _is_ a problem if the `..` is preceded by an INT: the
Hi Patrick,
On Sun, Nov 6, 2011 at 1:40 PM, Patrick Zimmermann patr...@zakweb.dewrote:
...
I still think that a scannerless parser might be a better alternative. Are
there any good reasons against switching (apart from ANTLR being a great
tool
in general)?
Nope, sorry, I don't have any
21:31:40 Bart Kiers wrote:
Hi Patrick,
On Sun, Nov 6, 2011 at 1:40 PM, Patrick Zimmermann patr...@zakweb.de
wrote:
...
I still think that a scannerless parser might be a better alternative.
Are there any good reasons against switching (apart from ANTLR being a
great tool
Hi Patrick,
The range operator, `..`, only works in lexer rules, not in parser rules as
you're doing. Capitalize the `letter` rule to make it a lexer rule:
grammar failuretest;
start: letter+;
Letter: 'A' .. 'B'; // or did you mean 'A'..'Z'?
and then try again.
Regards,
Bart.
Hi,
On Sat, Nov 5, 2011 at 4:16 PM, Patrick Zimmermann patr...@zakweb.dewrote:
Hi,
thank you a lot.
Using a lexer rule does in fact solve this problem.
And now I am already on the next:
stripped down to:
start : ('{' 'ab' '}')* '{a}';
using input:
{ab}{a}
Will not list
-
boun...@antlr.org] On Behalf Of Bart Kiers
Sent: Friday, November 04, 2011 1:48 AM
To: Fabien Hermenier
Cc: antlr-interest@antlr.org
Subject: Re: [antlr-interest] about range float and stuff
Hi Fabien,
Handling this in the parser will make your life much harder than it has
For what it's worth, I found the Wiki entry I based my suggestion on:
http://www.antlr.org/wiki/pages/viewpage.action?pageId=3604497
Regards,
Bart.
On Fri, Nov 4, 2011 at 3:11 PM, Bart Kiers bki...@gmail.com wrote:
You're welcome Fabien, but note that it most likely looks a lot like
without code. I
much prefer the solution proposed by Terence in
http://www.antlr.org/wiki/pages/viewpage.action?pageId=3604497 (which I
based my suggestion on): far less verbose than the first option, IMO.
Bart.
On Fri, Nov 4, 2011 at 5:59 PM, Bart Kiers bki...@gmail.com wrote:
The only wiki-link
like of course (though these are not
the same solution), but you should be accurate about the other solutions
and take the time to read through them.
Jim
-Original Message-
From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
boun...@antlr.org] On Behalf Of Bart Kiers
.
On Fri, Nov 4, 2011 at 6:30 PM, Bart Kiers bki...@gmail.com wrote:
I only know that Terence's solution solves the OP's problem AFAIK, whereas
yours I am not sure of: I simply find it too verbose to fully grasp by only
reading through it. Sorry.
Bart.
On Fri, Nov 4, 2011 at 6:18 PM, Jim Idle
and lots more, which is why it seems
verbose.
So, I don't know where you are going with the pedantry, but it is not
worth my time to follow it any more.
Jim
-Original Message-
From: antlr-interest-boun...@antlr.org [mailto:antlr-interest-
boun...@antlr.org] On Behalf Of Bart Kiers
Hi David,
ANTLR's lexer greedily matches characters: the input PRCLINTON is being
tokenized as a single VALUE-token, not as a PR- and VALUE-token.
Regards,
Bart.
On Mon, Oct 31, 2011 at 6:24 PM, Weiler-Thiessen, David, SASKATOON,
Engineering david.weiler-thies...@purina.nestle.com wrote:
Hi
immediately and promptly destroy the material and any
accompanying attachments from your system.*
*From:* Bart Kiers [mailto:bki...@gmail.com]
*Sent:* Monday, October 31, 2011 12:09 PM
*To:* Weiler-Thiessen,David,SASKATOON,Engineering
*Cc:* antlr-interest@antlr.org
*Subject:* Re: [antlr-interest
Apologies Jim, forgot to send to the list...
-- Forwarded message --
From: Bart Kiers bki...@gmail.com
Date: Thu, Oct 27, 2011 at 9:21 PM
Subject: Re: [antlr-interest] Fwd: Rule precedence works differently when
using a predicate?
To: Jim Idle j...@temporal-wave.com
On Thu, Oct
be matched by the ID rule instead of
the WHILE rule in:
WHILE : 'while';
ID : 'a'..'z'+;
(which is not the case, of course!)
Regards,
Bart.
On Thu, Oct 27, 2011 at 10:34 PM, Jim Idle j...@temporal-wave.com wrote:
.+ matches forever
Jim
*From:* Bart Kiers [mailto:bki...@gmail.com]
*Sent
On Mon, Oct 24, 2011 at 10:26 AM, Patrick Ericx patrick.er...@gmail.comwrote:
...
PS: is that mailing list available online? how can I access it ? receiving
all these mails in my mailbox becomes a little overhead for me.
Yes, here it is: http://antlr.markmail.org
Regards,
Bart.
List:
Hi all,
As I understand it, ANTLR's lexer matches rules from top to bottom in the .g
grammar file and when two rules match the same number of characters, the one
that is defined first has precedence over the later one(s).
However, take the following grammar:
grammar T;
@lexer::members {
On Mon, Oct 24, 2011 at 5:26 PM, Jim Idle j...@temporal-wave.com wrote:
Oh – I did not see it was a lexer error.
Reorder the rules:
IF :'if';
ID :('A'..'Z'|'a'..'z')+;
RAW:({rawAhead()}?= . )+;
Yeah, that is what I thought as well, but the above will cause
On Mon, Oct 24, 2011 at 5:33 PM, Bart Kiers bki...@gmail.com wrote:
... where I (and Boon) ...
Sorry, Bood, not Boon...
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
http://www.antlr.org/mailman/options/antlr-interest/your-email-address
--
You received
Hi Balazs,
Since PC is not a parser rule, you need to account for the space(s) between
'PC_HASH_VALUE' and DIGIT.
And since you've set `filter=true`, you don't need a fall-through rule ELSE,
AFAIK.
Regards,
Bart.
On Mon, Oct 17, 2011 at 11:15 AM, Balazs Varnai bvar...@gmail.com wrote:
Hi
Hi Graham,
Inside your parser-grammar, $typeSpec is the object that is returned by the
parser rule (RuleReturnScope). It includes, among others, the start- and
end-token and the tree of the rule. Using `.text`, which is short for
`getText()` will get the source of your input from `start` to `end`
Hi Yifan,
How about something like this:
foo: ^(VIRTUAL_NODE (bar {if($bar.value) return;})* );
?
Regards,
Bart.
2011/9/22 轶凡 yifan@taobao.com
Hi, I defined a tree grammar as below:
foo: ^(VIRTUAL_NODE bar*) {
echo($bar.value);
};
bar returns [boolean value] : //… Omitted
Hi Vivek,
On Mon, Sep 19, 2011 at 4:04 AM, Vivek Jhaveri vivekjhav...@hotmail.comwrote:
...
To date, our efforts have yielded accuracy, but not performance.
Hard to comment without seeing the grammar(s).
Do you by any chance have `backtrack=true;` in the options-section of your
parser? If
Hi Ter, others,
Perhaps generics could be introduced in v4?
public interface TreeT {
TreeT getParent();
T getPayload();
TreeT getChild(int i);
int getChildCount();
String toStringTree();
}
Regards,
Bart
On Sun, Sep 4, 2011 at 11:47 PM, Terence Parr
Hi,
On Fri, Sep 2, 2011 at 1:51 AM, Dejas Ninethousand dejas9...@gmail.comwrote:
For this grammar with an empty string input:
grammar PySON;
...
I think you forgot to ask your question.
Regards,
Bart.
List: http://www.antlr.org/mailman/listinfo/antlr-interest
Unsubscribe:
On Sun, Aug 28, 2011 at 11:36 PM, Bart Kiers bki...@gmail.com wrote:
... Fragment rules are only for other *fragment* rules: the parser has no
notion of them. ...
Correction, I meant to say: *Fragment rules are only for other lexer rule**s
...*
Note that you can also call a fragment from
Hi Jonne,
No, that is not possible with a quantifier like {x}. You'll have to do it
the hard way:
ACCOUNT
: NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER NUMBER
;
Regards,
Bart.
On Sun, Aug 28, 2011 at 3:20 PM, Jonne Zutt jonne.zutt...@gmail.com wrote:
Dear all,
Is it possible
Hi Jonne,
*On Sun, Aug 28, 2011 at 10:26 PM, Jonne Zutt jonne.zutt...@gmail.com
wrote:
*
*...
pieces
: ('p'|'P' | 'n'|'N' | 'b'|'B' | 'r'|'R' | 'q'|'Q' | 'k'|'K' |
'1'..'8')+;
*
In parser rules, you _can_ use literal tokens, but it's best to refrain
from doing this: create
Hi Jonne,
After skimming through the Wiki page you mentioned, I realize what you mean
by overlap. Then no, making fragments will not help you since you will
only know at parse-time if a digit should be a part of a `number` or a
`rank` or a `move`. Fragment rules are only for other fragment rules:
On Fri, Aug 26, 2011 at 1:40 PM, Adam Adamski thebigsma...@gmail.comwrote:
Dear all ANTLR users,
Hi Adam,
Is it a mistake to use variable like I used? I mean:
rule:
IDN typ=(type1|type2|typ3)
;
Yes, you can't do that. Try this instead:
rule
: (ARRAY_OF)* intermediate
Hi Garry,
You either use inline operators ^ and !, or use a rewrite rule, not both. To
reference a rule, add a $ before its label:
mapType
: 'map' '' k=anyType ',' v=anyType '' - ^('map' $k $v)
;
but I think this should work too:
mapType
: 'map' '' anyType ',' anyType '' - ^('map'
Could you post your grammar(s) and actual input?
Example input containing is not really helpful.
Regards,
Bart.
On Mon, Aug 22, 2011 at 1:27 PM, Swathi V swat...@zinniasystems.com wrote:
Would be thankful if anyone helps me out.
Problem :
I have a huge file with certain categories
Hi Романов,
How about something like this:
grammar INIFile;
parse
: Comment* section+ EOF
;
section
: SectionStart (property | Comment)*
;
property
: NameOrValue (Assign valueList?)? eol
;
valueList
: (Separator | NameOrValue)+
;
eol
: LineBreak
| Comment
| EOF
Hi Todd,
Well, `EOL : ('\r' | '\n')+;` matches a single `\n`. So my guess is that
some other rule in your grammar matches a `\n` as well. Can you post a
complete (small) grammar that shows the problem you're having?
Regards,
Bart.
On Thu, Aug 4, 2011 at 8:37 PM, Stevenson, Todd (GE
Hi Samuel,
Your input:
history:
is not tokenized as a STRING but as a WORD. You need to tell exclude the
double quote in your WORD rule.
Also, you put '\n' on the HIDDEN channel, yet you use it in your parser rule
'command'. This will cause the rule to never match properly: you need to
FYI:
http://stackoverflow.com/questions/6847971/antlr-identifier-with-whitespace
On Wed, Jul 27, 2011 at 7:39 PM, Lukas Glowania lukas.glowa...@rub.dewrote:
Hi,
i want identifiers that can contain whitespace.
|grammar WhitespaceInSymbols;
premise : ( options {greedy=false;} : 'IF' )
And by default, greedy=true (except with .* and .+), so in this case, one
could simply write
STRING_LITERAL
: '' ('' | ~'')* ''
;
AFAIK.
Regards,
Bart.
On Wed, Jul 27, 2011 at 9:54 PM, Sam Harwell sharw...@pixelminegames.comwrote:
You're reading the greedy option in reverse. :) I'd
On Wed, Jul 27, 2011 at 10:06 PM, G. Richard Bellamy rbell...@pteradigm.com
wrote:
Thanks to both of you for your help.
Clearly I understated things when I said I was confused.
1. I was under the impression that greedy=true was the default, in every
case. For instance, in The Definitive
Hi Richard,
Both ANTLRWorks' debugger, and my Java test rig:
import org.antlr.runtime.*;
public class Main {
public static void main(String[] args) throws Exception {
WhitespaceInSymbolsLexer lexer = new WhitespaceInSymbolsLexer(new
ANTLRStringStream(\\));
WhitespaceInSymbolsParser
of non-escaped quotes... (C# Verbatim String), so
you'll not be able to test this on your end (since Java doesn't have an
equivalent to the Verbatim String).
Thanks again.
-rb
On 7/27/2011 2:10 PM, Bart Kiers wrote:
Hi Richard,
Both ANTLRWorks' debugger, and my Java test rig
A quick test with Mono confirmed it, @ is just a single quote:
Console.WriteLine(@);
prints 1 quote! That's the problem.
Bart.
On Wed, Jul 27, 2011 at 11:25 PM, Bart Kiers bki...@gmail.com wrote:
Richard,
Note that I am a C# illiterate, but, isn't the C# literal:
@
only just
But you'd have to have a good reason to use a string literal as a parser
rule instead of a lexer rule.
Bart.
On Tue, Jul 26, 2011 at 9:16 AM, Rob Aarnts r...@aarnts.com wrote:
You're entirely right. I use this trick but with a parser rule in stead
of a lexer one. So SINGLE_QUOTED_STRING
Hi Qiao,
With Java as the target, you could do:
SINGLE_QUOTED_STRING
@after {
String s = getText();
setText(s.substring(1, s.length() - 1));
}
: SQUOTE (~SQUOTE)* SQUOTE
;
Regards,
Bart.
On Sun, Jul 24, 2011 at 2:43 PM, Mu Qiao qiao...@gmail.com wrote:
I have some token rules
Hi Luigi,
I'm not sure if this is possible with ANTLR, or any other LL parser
generator.
See this for a work-around:
http://stackoverflow.com/questions/3799890/antlr-ast-generating-possible-madness
If it _is_ possible using some sort of fancy AST rewrite magic, I'm sure
someone will correct me.
Hi Sam,
But of course, with the inline tree rewrite operators it looks so straight
forward! Nice one!
Regards,
Bart.
On Thu, Jul 21, 2011 at 3:52 PM, Sam Harwell sharw...@pixelminegames.comwrote:
Your example is ambiguous as well as left recursive. I assume you meant one
of the following:
listing method described in the (very useful
!) posts from Bart Kiers about its tutorial with the TL language.
My problem is that his method applied on my grammar outputs nothing.
I banged my head against my desk for a while for looking what I did
wrong with reusing Bart's code, until I tested his
Try:
INTEGER
: DIGIT+ { print($text) }
;
Regards,
Bart.
On Wed, Jul 13, 2011 at 9:57 PM, Udo Weik weikeng...@aol.com wrote:
Hello,
I just want to access the attributes of INTEGER
and DIGIT - but how?
INTEGER: DIGIT+ { print( L: (INTEGER): ) } ;
fragment
DIGIT: '0'..'9' {
Hi Udo,
`$text` is just a shorthand notation for `$XYZ.text` where `XYZ` is the rule
you're currently in.
Regards,
Bart.
On Wed, Jul 13, 2011 at 10:18 PM, Udo Weik weikeng...@aol.com wrote:
Hello Bart and others,
yep, thanks, it works...
Try:
INTEGER
: DIGIT+ {
Oh, and since `DIGIT` is called from `INTEGER`, the `$text` from `DIGIT`
references `$INTEGER.text`.
Regards,
Bart.
On Wed, Jul 13, 2011 at 10:18 PM, Udo Weik weikeng...@aol.com wrote:
Hello Bart and others,
yep, thanks, it works...
Try:
INTEGER
: DIGIT+ { print($text) }
Hi Udo,
Ah yes, apologies: you can only reference parser rules like that:
parserRule : LexerRule { print($parserRule.text) } ;
and *not*:
LexerRule : OtherLexerRule { print($LexerRule.text) } ;
Regards,
Bart.
On Wed, Jul 13, 2011 at 10:27 PM, Udo Weik weikeng...@aol.com wrote:
Hello
Hi Shane,
Inside a combined- or lexer- or parser grammar, the `tokens` should be
placed before the `members` section(s):
(lexer | parser)? grammar ...
options { ... }
tokens { ... }
@header { ... } (or: @parser::header { ... }, @lexer::header { ... })
@members { ... } (or: @parser::members {
Hi Chris,
Very original! :)
Try to do more in lexer rules. Some of your keywords may probably also be a
part of the instruction phrase: you need to be aware of that.
How about something like this:
grammar KnittingGrammer;
parse
: instruction+ EOF
;
instruction
: section FullStop
|
Hi James,
Something like this would do the trick:
lines
: (LineStartingWithPlus | LineNotStartingWithPlus | LineBreak)* EOF
;
LineStartingWithPlus
: '+' ~('\r' | '\n')*
;
LineNotStartingWithPlus
: ~'+' ~('\r' | '\n')*
;
LineBreak
: ('\r'? '\n' | '\r')
;
Regards,
Bart.
Hi Mark,
I presume you didn't see my answer on Stackoverflow:
http://stackoverflow.com/questions/6529359/how-to-pass-commontree-parameter-to-an-antlr-rule
?
If you did, is there anything that wasn't clear?
Regards,
Bart.
On Thu, Jun 30, 2011 at 2:26 PM, Mark Truluck
– thanks very much.
Mark
From: Bart Kiers bki...@gmail.com
Date: Thu, 30 Jun 2011 14:42:53 +0200
To: Mark Truluck mark.trul...@cogiton.com
Cc: antlr-interest@antlr.org interest antlr-interest@antlr.org
Subject: Re: [antlr-interest] rule parameter question
Hi Mark,
I presume you didn't
and a CommonTree will
be used as default Treeimplementation. To avoid casting, set the type of
tree in your options { ... } section:
options
{
output=AST;
ASTLabelType=CommonTree;
}
On Thu, Jun 30, 2011 at 3:20 PM, Bart Kiers bki...@gmail.com wrote:
No problem: SO _does_ work
Can you give an example of your input, and explain what line you want to
ignore?
Regards,
Bart.
On Thu, Jun 30, 2011 at 10:33 PM, Nilo Roberto C Paim nilop...@gmail.comwrote:
Hi all,
I'm trying to parse a text file created by an application. There are lines
in this text file that I know
:
You could use the filter=true grammar option to discard tokens that don't
match anything
On Thu, Jun 30, 2011 at 10:36 PM, Bart Kiers bki...@gmail.com wrote:
Can you give an example of your input, and explain what line you want to
ignore?
Regards,
Bart.
On Thu, Jun 30, 2011 at 10:33
Hi Fabien,
Can you post the grammar that produces the error?
Bart.
On Wed, Jun 29, 2011 at 5:57 AM, Fabien Hermenier hermenierfab...@gmail.com
wrote:
Hi
I am sorry, but this is another problem related to sequence of integer.
I don't understand my error(s), despite severals
pass on the
The interpreter is only suitable for very small grammars (without
predicates!). For more complicated grammars, use ANTLRWorks' debugger
instead.
Regards,
Bart.
On Sat, Jun 25, 2011 at 10:25 PM, Mike Kappel mkap...@appfluent.com wrote:
I just downloaded ANTLRWorks and tried the example
(...) is returning a String.
Fabien.
Le 22/06/11 00:36, Bart Kiers a écrit :
Fabien, but what is the return type of this `merge(...)` method? Could you
post the method? Or even better: post a SSCCE http://sscce.orgthat
causes such an exception?
Regards,
Bart.
On Wed, Jun 22, 2011
The file `/META-INF/MANIFEST.MF` is missing the 'Main-Class' attribute. Add
the line:
Main-Class: org.antlr.Tool
to the file (inside the JAR) and all should be OK.
Regards,
Bart.
On Mon, Jun 20, 2011 at 6:28 PM, Julien BLACHE j...@jblache.org wrote:
A Z asicaddr...@gmail.com wrote:
Meena,
You appear to be running a v3.1 lexer parser with the run-time classes
from v3.3.
On Stackoverflow I recommended you generate a new lexer and parser using
ANTLR v3.3 (and compile them!) which you can then use with the ANTLR v3.3
runt-time classes. Did you do that already?
Bart.
On Tue,
that *getNodeIndex(obj)*
Method is missing.
Thanks,
Meena.
*From:* Bart Kiers [mailto:bki...@gmail.com]
*Sent:* Tuesday, June 14, 2011 4:38 PM
*To:* Meena Subramanian (WT01 - Banking Financial Services)
*Cc:* antlr-interest@antlr.org
*Subject:* Re: [antlr-interest] Facing
it to maximum (see
first line of attached screenshot)
However I see in my editor (antlrworks) in interpreter tab: Ignore
rules: WHITESPACE.
I wonder why, I did not ask for such ignore, and I do not see how to
remove this.
Maybe this occurs in generated code too.
Olivier
Le 6/8/11 12:58 PM, Bart
Hi David,
Try this:
(ID GETS) = ID GETS expr SEMI? - ^(GETS ID expr SEMI?)
Regards,
Bart.
On Tue, Jun 7, 2011 at 1:41 PM, David Smith david.sm...@cc.gatech.eduwrote:
I'm parsing a grammar in which the semicolon on the end of a line is
optional. So two of the statement rules might be:
Jim,
From an earlier message, David wrote: *Yes, the language is Matlab and a
semicolon on the end of an assignment expression suppresses display of the
result of the assignment. ...*
Bart.
On Tue, Jun 7, 2011 at 6:30 PM, Jim Idle j...@temporal-wave.com wrote:
Why do you want the SEMI in
Hi George,
Sure, use Markmail: http://antlr.markmail.org/
http://antlr.markmail.org/Regards,
Bart.
On Sun, Jun 5, 2011 at 3:59 PM, George Spears geo...@woh.rr.com wrote:
Hello,
The ANTLR interest archives have a lot of valuable information in them..
Hi Nilo,
The grammar:
grammar Brasil;
parse
: WORD EOF
;
WORD
: ('\u00c0'..'\u00ff' | 'a'..'z' | 'A'..'Z' | '-')+
;
parses the input não just fine in ANTLRWorks.
I'm not really familiar with C#, but for those who are, could you perhaps
post *how* you are testing it? (post a
On Mon, May 30, 2011 at 9:23 PM, ante...@freemail.hu wrote:
On 5/30/2011 11:20 PM, Bart Kiers wrote:
On Mon, May 30, 2011 at 9:13 PM, ante...@freemail.hu wrote:
On 5/30/2011 10:41 PM, Bart Kiers wrote:
Could you stop spamming the ANTLR mailing list please?
Bart.
You may not know
) == '*') {
isJavaDoc = true;
}
}
(options {greedy=false;} : . )*
'*/'
;
Regards,
Bart Kiers.
On Mon, May 30, 2011 at 8:08 PM, Vijay Raj call.vijay...@yahoo.com wrote:
Hi -
I am trying to parse a given java file, with a code fragment that
consumes
On Mon, May 30, 2011 at 10:38 PM, Jim Idle j...@temporal-wave.com wrote:
It always been OK, but there is obvious common sense involved, such as not
posting such messages every week. For a start, I make a lot of my living
writing professional ANTLR grammars and occasionally, you need to ask for
Hi Patrick,
I have a hard time understanding what it is you're trying to do.
Instead of springing the entire grammar on us (or me), could you extract
only those rules that are causing the problem(s)? And could you include some
example input you'd like to match/parse?
Regards,
Bart Kiers
Hi David,
Can an `expr` match something that starts with `ID OPENP` and/or `ID GETS`?
Perhaps you can post your entire grammar? Or at least the `expr` rule?
Regards,
Bart.
On Thu, May 26, 2011 at 7:02 PM, David Smith david.sm...@cc.gatech.eduwrote:
I am having a difficult time
Hi David,
Every root (or leaf) in the AST must be an instance of a `
org.antlr.runtime.tree.Tree`, so you can't create a node that is a
`java.util.List`.
By default, ANTLR creates its AST using `org.antlr.runtime.tree.CommonTree`
objects which inherits the `getChildren()` method from
Hi David,
Your parser does not handle:
ans = 3 * (-x + y) * 4
properly since `ans` is an ANS-token and not an IDENT-token. Therefor it
does not get matched by your `assignmentStatement` rule.
Also, you should probably add the EOF at the end of your `script` rule in
your combined grammar.
Hi
Your rule:
targetsExpr
: category ('CAND' targetsExpr)* - ^('CAND' category targetsExpr*)
;
is incorrect. You're always using `CAND` in your rewrite rule but that rule
could just match `category` only.
You'll probably want to do:
targetsExpr
: category ('CAND'^ targetsExpr)*
;
On Fri, May 20, 2011 at 9:54 PM, massimiliano.m...@gmail.com
massimiliano.m...@gmail.com wrote:
Hi,
On Fri, May 20, 2011 at 10:55 AM, Bart Kiers bki...@gmail.com wrote:
targetsExpr
: category ('CAND' targetsExpr)* - ^('CAND' category targetsExpr*)
;
is incorrect. You're always
Hi Rajesh,
Inside a parser rule, the `~` negates tokens, not characters. So if you have
no lexer rule that tokenizes one of: '%', ''^' or '$', then ~SEMICOLON won't
match any of such tokens/characters.
Your grammar (with minor modifications):
grammar Test;
options {
output=AST;
}
tokens {
Hi Ben,
You cannot use fragment rules inside parser rules. So yes, you need to make
LKU a normal token. If you don't want that (for whatever reason), you need
to include the '' in the 'NAME' rule:
NAME
: '' ('a'..'z')+
;
Regards,
Bart.
On Wed, May 18, 2011 at 3:00 PM, Ben Corne
Hi David,
The snippet:
@header {
package parser;
import java.util.HashMap;
}
is short for:
@parser::header {
package parser;
import java.util.HashMap;
}
You'll need to do the following as well:
@lexer::header {
package parser;
import java.util.HashMap;
}
Regards,
Bart.
On Fri, May
CommonTokenStream inherits getTokens() which returns a List of Tokens.
You'll need to cast them to a Token (or something that extends a Token),
since it's a non-generics List list:
CommonTokenStream tokens = new CommonTokenStream(lexer);
for(Object o : tokens.getTokens()) {
Token t = (Token)o;
I get the impression you think that when creating AST's, ANTLR inserts
parenthesis (brackets). This is not the case: I guess what you're seeing is
just the tree's `toStringTree()` that displays these parenthesis to make the
hierarchy of the tree apparent.
Or am I misinterpreting your question?
tree.
See: http://www.antlr.org/wiki/display/ANTLR3/Tree+construction
or:
http://stackoverflow.com/questions/4931346/how-to-output-the-ast-built-using-antlr
Regards,
Bart.
On Mon, May 9, 2011 at 4:10 PM, Bart Kiers bki...@gmail.com wrote:
I get the impression you think that when creating
1 - 100 of 173 matches
Mail list logo