I am relatively new to ANTLR and am trying to use the PHP grammar that has been
used with the ANTLR PHP target. This grammar handles the first input token
separately as
a first body string using the following Java Code to override the nextToken()
function.
@lexer::members{
// Handle the f
Greetings!
On Mon, 2010-07-19 at 21:00 -0400, Billy O'Neal wrote:
> Hello, Kirby Bohling.
>
> It's similar to Keyword Vs. ID, but not exact. Consider the following inputs:
>
> -arg#hashed#
> Result:
> ARGUMENT (Text="arg")
> ARGEXTRA (Text="hashed")
>
> -arg#hashed# #otherData#
> Result:
> ARGU
Hello, Kirby Bohling.
It's similar to Keyword Vs. ID, but not exact. Consider the following inputs:
-arg#hashed#
Result:
ARGUMENT (Text="arg")
ARGEXTRA (Text="hashed")
-arg#hashed# #otherData#
Result:
ARGUMENT (Text="arg")
ARGEXTRA (Text="hashed")
OTHER (Text="#otherdata#") <-- Note that the ha
If you aren't going to lex that token to something else, I'm pretty
sure the right solution is to just lex it as the invalid token. If
you are going to lex it to something else, then likely you have the
"keyword" vs. "id" problem (use one token for it in the lexer, and
pick which one it really is
Hello, Everyone :)
Was referred here from my StackOverflow question:
http://stackoverflow.com/questions/3278338/using-the-antlr-c-target-how-can-i-get-the-previously-matched-token-in-the-lexer
I'm quite new to ANTLR; and my Lexer needs to have a gated rule which
makes it valid if and only if it o
Thanks Jay
That did it.
On Jul 19, 2010, at 15:52 , Junkman wrote:
> Hi Bill,
>
> You have
>
> import antlr.*;
>
> instead of
>
> import org.antlr.runtime.*;
>
> Maybe that's the problem?
>
> org.antlr.runtime.CommonToken implements org.antlr.runtime.Token, so
> explicit casting seems out
Hi Bill,
You have
import antlr.*;
instead of
import org.antlr.runtime.*;
Maybe that's the problem?
org.antlr.runtime.CommonToken implements org.antlr.runtime.Token, so
explicit casting seems out of wack.
Jay
Bill Andersen wrote:
> Thanks John
>
> Below is my class def.. Eclipse tells me
Use the:
identifier : KEY1 | KEY2 | ... | ID ;
But when you have:
r: KEY1 ...
| identifier
;
You just need a one token predicate and lists the keyword stuff first.
r: (KEY!)=>KEY1 ...
| identifier
;
I have built entire SQL parsers using this approach and SQL is probably the
king of amb
Cid Dennis wrote:
> So I am new to ANTLR and have created a grammar but found a strange issue.
> Because of the structure of the language I am parsing there can be tokens
> that match reserved works as variables but only when they are in a sub rule
> that does not use the reserved word.
>
> ..
Thanks John
Below is my class def.. Eclipse tells me the casts to Token below are
required. Running a grammar that executes these constructors tells me I can't
cast to Token.
Here's a sample tree building expression where this class is used.
^(AS_TYPE_LIST[s.getType($ID.text)] ID)
t
On Mon, 2010-07-19 at 14:29 -0400, Bill Andersen wrote:
> Hi folks
Greetings!
>
> Having some trouble making ASTs using a custom node type. Before I ask any
> stupid questions, what is the best place to look on how to do this ( I'm
> using 3.2 )? I'm finding bits and pieces, some of them con
Hi folks
Having some trouble making ASTs using a custom node type. Before I ask any
stupid questions, what is the best place to look on how to do this ( I'm using
3.2 )? I'm finding bits and pieces, some of them contradictory. For example I
find this example
static class V extends CommonTre
Hello,
I am using antlr/C# to create a scripting language with a step-through
debugger that highlights in yellow the line of code that is about to
execute. I was able to identify the line number based on the 'Line' property
of my Antlr-generated AST node (Antlr.Runtime.Tree.ITree,
Antlr.Runtime.T
Greetings!
On Mon, 2010-07-19 at 09:52 -0600, Cid Dennis wrote:
> So I am new to ANTLR and have created a grammar but found a strange issue.
> Because of the structure of the language I am parsing there can be tokens
> that match reserved works as variables but only when they are in a sub rule
So I am new to ANTLR and have created a grammar but found a strange issue.
Because of the structure of the language I am parsing there can be tokens that
match reserved works as variables but only when they are in a sub rule that
does not use the reserved word.
In the example below "ruleset" i
15 matches
Mail list logo