mageran / node-xsyn

Extensible syntax for nodejs - under construction
0 stars 1 forks source link

Custom Tokens Defined using Regular Expressions #5

Open sree93hari opened 8 years ago

sree93hari commented 8 years ago

Custom Tokens Defined using Regular Expressions is working weirdly when we define multiple tokens


E.g. Tokens : Tokens Token {% $$ = $1 + " " + $2; %} | Token {% $$ = $1; %} ;

Token : Token1 {% $$=$1+'Token1'; %} | Token2 {% $$=$1+'Token2'; %} ;

token $ Token1 : '[h][_][a-z]' ;

token $ Token2 : '[m][_][a-z]' ;

Input: h_a m_d h_b

Expected Output : h_aToken1 m_dToken2 h_bToken1

Actual Output: h_aToken1 m_dToken1 h_bToken1

mageran commented 8 years ago

yes, this is a bug. Internally, the matches are done correctly, but the token generation is not propagating this. Will try to fix it for the next update. --Matthias

On Sun, Dec 27, 2015 at 11:18 PM, sree93hari notifications@github.com wrote:

Custom Tokens Defined using Regular Expressions is working weirdly when we

define multiple tokens

Eg Tokens : Tokens Token {% $$ = $1 + " " + $2; %} | Token {% $$ = $1; %} ;

Token : Token1 {% $$=$1+'Token1'; %} | Token2 {% $$=$1+'Token2'; %} ;

token $ Token1 : '[h][][a-z]' ; token $ Token2 : '[m][][a-z]' ;

Input: h_a m_d h_b

Expected Output : h_aToken1 m_dToken2 h_bToken1

Actual Output: h_aToken1 m_dToken1 h_bToken1

— Reply to this email directly or view it on GitHub https://github.com/mageran/node-xsyn/issues/5.