repository stringclasses 156 values | issue title stringlengths 1 1.01k ⌀ | labels stringclasses 8 values | body stringlengths 1 270k ⌀ |
|---|---|---|---|
antlrantlr4 | csharp and java produce different result for identical input identical token | Bug | antlr 4 9 1 parser for grammar v4 idl idl g4 with the input show below be produce different result to be clear the parser should produce identical output but they do not the list of tokens be identical between java and csharp so the lexing be identical there be no action semantic predicate in idl g4 and I have remove the custom error listener generate by my program for both target so it can not be attribute to those possible issue I believe there be a problem in one or the other antlr4 runtime I also test this across the other target after rename the parser symbol export which conflict with certain target the parser produce different result for dart and go the input be accept for javascript and python3 the input be reject the error output by the parser be line 3 2 mismatch input interface expect typedef custom struct native eventtype enum home exception const module union abstract typeprefix typeid component bitset bitmask annotation to reproduce use dotnet antlr v2 2 0 module helloapp interface hello string sayhello oneway void shutdown |
antlrantlr4 | fix codegen template for go parser | Bug | this fix 2826 it add the required pointer receiver and type assertion to the getinvokingcontext call no change to the runtime be necessary |
antlrantlr4 | fix 3052 | Bug | fix 3052 the problem be cause by an undefined ruleindex attribute call getruleindex method instead of access the ruleindex attribute solve this problem |
antlrantlr4 | update ll1 analyzer | Bug | potentially fix 3042 |
antlrantlr4 | split version number for target | Question | hiya pboyer mike lischke janyou ewanmellor hanjoe ericvergnaud lingyv li marcospassos eric have raise the point that it would be nice to be able to make quick patch to the various runtime e g there be a stop bug now in the javascript target he propose something along these line any change in the tool or the runtime algorithm bump the middle version 4 9 4 10 4 11 any bug fix in a runtime we bump the last digit of that runtime only 4 9 4 9 1 4 9 2 if bump the java runtime for bug fix we also bump the tool since it contain the runtime this be in optimal as people have criticize I in the past for bumping say 4 6 to 4 7 for some minor change it also have the problem that 4 9 x will not mean the same thing in two different target possibly as each target will now have their own version number rather than break up all of the target into separate repository or similar can you guy think of a well solution any suggestion the goal here be to allow more rapid target release and independent of I have to do a major release of the tool |
antlrantlr4 | update get start md | Duplicate | this fix 2895 this update get start md to point to the late version of antlr 4 7 1 4 8 this clarify some of the command be do |
antlrantlr4 | fix a npe | Bug | parrt bump into this bug with the js runtime cause I suspect by a bug which may affect all target the root cause would come from predictioncontext merge line 169 and 172 where an arraypredictioncontext be create from a singletonpredictioncontext which be some case be an emptypredictioncontext with a null parent this translate into arraypredictioncontext parent be initialize to null which be a nasty code smell I ll happily fix it if you think it make sense just let I know |
antlrantlr4 | another attempt at solve this issue | Bug | there be already a patch to fix this issue 2037 but it have some problem and be close by the author after a while |
antlrantlr4 | general xpath fix for the python3 runtime | Bug | this commit fix some code that do not reflect the current api fix wrong xpath library behavior such as fail to apply the invert flag on certain operation do general style touch up further work be necessary such as implement test for this functionality so that further change to the api or runtime win t break functionality and maybe separate the interpreter datum from the library code for now a code review would be stellar |
antlrantlr4 | fix javascript hash bug | Bug | completely fixes bug find by akajes thank parrt fully test good for merge |
antlrantlr4 | feature request support unicode category | Question | support match unicode category by something like p l see 1196 antlr grammar v4 1426 yes we can just copy paste from lexuincode g4 but it s 600 line long more than half of javascriptlexer g4 be unicode category definition generate from database and it s hard to manage if unicode add some new character we need update copy paste content in all g4 file bash user pc git clone clone into grammar v4 remote enumerate object 20 do remote counting object 100 20 20 do remote compressing object 100 16 16 do remote total 20505 delta 3 reuse 12 delta 2 pack reuse 20485 receiving object 100 20505 20505 20 50 mib 1 35 mib s do resolve delta 100 10079 10079 do check out file 100 4716 4716 do user pc cd grammar v4 user pc grammar v4 find grep g4 wc l 260 user pc grammar v4 |
antlrantlr4 | fix overlaping condition | Bug | fix proposition for |
antlrantlr4 | fix import in the python2 source | Bug | contrary to python3 the lexer and parser generate for python2 target support only relative import which cause a failure in case of standalone script the patch adapt these import to work in both case |
antlrantlr4 | fix index error in python3 getchild | Bug | fix 2485 |
antlrantlr4 | fix python get text api | Bug | not sure how some stuff make it to master but incorrect semantic with interval and gettext have lead to lot of confusion purpose of this pr be to restore a unambiguous api such that contributor can rely on a clear contract |
antlrantlr4 | bugfix for python runtime tokenstreamrewriter gettext | Bug | this be a bug if I insert something after the last token that insertation will be execute twice a minimal working example be test g4 grammar test ruleabc aa eof test txt aa test py import sys from antlr4 import from testlexer import testlexer from testparser import testparser from antlr4 tokenstreamrewriter import tokenstreamrewriter from collection import namedtuple from testlistener import testlistener interval namedtuple interval start stop class mylistener testlistener def init self tokens bufferedtokenstream none super init self writer tokenstreamrewriter token def gettext self return self writer gettext tokenstreamrewriter default program name interval 0 len self writer token token def enterruleabc self ctx testparser ruleabccontext self writer insertaftertoken ctx stop it appear first n def main argv input filestream test txt if len argv 1 else argv 1 lexer testlexer input stream commontokenstream lexer parser testparser stream tree parser ruleabc mylistener mylistener stream walker parsetreewalker walker walk mylistener tree print mylistener gettext if name main main sys argv the output be aait appear first it appear first the purpose here be to insert one sentence however it end up that two sentence be insert |
antlrantlr4 | allow modifying of parsetree | Question | I m currently write a language and would like to use the visitor listener to pre process the ast to simplify the compilation process this mostly mean modify the structure by add remove child my trouble be the iteration in parsetreewalker seem to assume the ast be immutable eg it cache the child count before iterate the current work around be to translate the parsetree into another custom graph type that can then be edit be there any way of allow parsetreewalker to handle mutation to the ast while iterate or maybe add a new walker that can do that |
antlrantlr4 | be antlr use anltr to build | Question | hi all be antlr use antlr to build what be the g4 file to parse g4 grammar I want to fix this issue thank peter |
antlrantlr4 | avoid stringindexoutofboundexception | Bug | this fix issuecomment 397271786 clearly it s be an oversight since the same code have be fix for codepoint8bit in this commit |
antlrantlr4 | enable parseratnsimulator debug mode in python3 target | Bug | solve issue 2291 test on my sample file and it work as expect take the opportunity to sign contributor txt |
antlrantlr4 | javascript parse tree visitor check if ctx child be non null in visitchildren | Bug | I ve be encounter a problem where the default generate visitor in javascript it will crash because in the visit method it try to call accept on null because it have be pass a null object by visitchildren this seem like a bug to I as the child field be expect to sometimes be null as it be initialise to null and only make non null when a child be add other place handle this case explicitly but here it s assume to be non null make the change in this pr make my visitor work correctly do you think it be the right change to make or if not what should I be do instead to explain my reasoning on why this change and not any other the check could easily be ctx getchildcount 0 and behave the same I go for this as it s short and we re already access ctx child directly instead of use getchild so it seem in keep with the current code the check could also have be do in visit by change the else to else if ctx but this seem a more intrusive way of fix it and it s entirely reasonable for visit to expect a non null argument |
antlrantlr4 | unhelpful error message | Question | issue reproducible with antlr version 4 5 code generation target java with the follow grammar and start rule name l59 be expreof grammar g expreof expr eof expr uident expr uident uident a z a z ws n t skip expression foo a b give I meaningful error message as expect line 1 6 extraneous input b expect expreof expr expr foo a b however without change start rule name if I add a new rule expr2 which will not be use at all grammar g expreof expr eof expr uident expr uident expr2 expr uident uident a z a z ws n t skip error message then become the following which give no clue at all line 1 3 mismatched input expect expreof expr foo a b |
antlrantlr4 | python3 runtime say 4 6 not 4 7 | Invalid | def checkversion self toolversion runtimeversion 4 6 rvmajor rvminor self extractversion runtimeversion tvmajor tvminor self extractversion toolversion if rvmajor tvmajor or rvminor tvminor print antlr runtime and generate code version disagree runtimeversion toolversion |
antlrantlr4 | unify the python2 and python3 code basis into a single library compatible with both | Question | it be very awkward to see two entirely separate tree of code for python 2 7 vs python 3 how be these even maintain the normal thing for python library that support both be to write code compatible with both I strongly recommend unify they |
antlrantlr4 | add new keyword to return proper inputstream | Bug | currently the js runtime charstream fromstre sometimes return and mangle the global window object instead of return a proper inputstream this be prevent by use the new keyword in this and similar helper method bhamiltoncx please take a look perhaps I m do something wrong if so I m happy to be mistake |
antlrantlr4 | python 3 codegen probably didn t mean to limit atn segment size to 2 xor 31 | Bug | notice this poking around in the python 3 codegen 2 31 be not 231 it s 2 xor 31 which be 29 |
antlrantlr4 | a segmentation fault occur while output a parse tree | Question | I use class like the follow someparser h class someparser private std string vendor public antlr4 parser parser antlr4 lexer lexer public someparser std string vendor antlr4 tokensource get token const std string text std vector get lexem const std string text antlr4 parserrulecontext parse std string text someparser cpp include concreteparser h my realization antlr4 parserrulecontext someparser parse std string text antlr4 charstream istream new antlr4 antlrinputstream text lexer setinputstream istream antlr4 commontokenstream tokens lexer tokens fill parser settokenstream token antlr4 parserrulecontext tree dynamic cast parser root std cout parse root dynamic cast tree tostringtree parser std endl return tree main cpp int main someparser myparser tree parsetree tree myparser parse std cout root tree tostringtree myparser parser std endl return 0 if tree be print in someparser parse all be good but when tree be print in main a segmentation fault occur I think because the tree refer to external token these token be local to the function parse and they be desctroye when the function exit |
antlrantlr4 | grammar good practice for similar rule | Question | hi everyone I m contemplate on good practice and performance implication for the follow grammar scenario memberdef varmemberdef valmemberdef defmemberdef varmemberdef var nameid colon type memberblockstart memberblock valmemberdef val nameid colon type memberblockstart memberblock defmemberdef def nameid argdecls colon type memberblockstart memberblock as you can see these three member definition rule mainly differ on the first var val def token and could be merge into a more compact single rule version memberdef var val def nameid argdecls colon type memberblockstart memberblock this rule basically cover the previous scenario but be a bit more forgiving and require additional validation logic to be add as an extra pass after the parsing why I m lean toward the first version be that it allow I to include some more refined logic on what must follow what during the parse phase without any additional logic it also seem to be easy to modify one of the version without affect the other which seem useful while evolve the grammar so I m wonder which of these be in general a good practice would you prefer will this have any other implication later during the evaluation of parse result will the above version differ much in performance give that I use the first approach over the latter throughout all my definition thank |
antlrantlr4 | support tree rewrite | Duplicate | while the focus of antlr4 be unfortunately no long for compiler interpreter transpiler writer I use it for a transpiler anyway antlr4 be so much nice grammar wise than antlr3 however the lack of tree rewrite mutation be drive I crazy this be for special case of course but when you do need it say for normalization you end up do ugly duplication on a side ast all I really need be mutator on the generate vector string field this be the c backend I can t even call settext now anyway frustrate any plan for tree mutation |
antlrantlr4 | use c anltr 4 5 3 stable code generation doesn t compile with error compareto | Invalid | hi use antlr4 5 3 with visual studio 2015 to process the cpp14 g4 grammar file on github fail to compile there be an error in the generate code compareto not be a method on a string in c it should be compareto capital c |
antlrantlr4 | remove generate swift file or add regression test | Invalid | the path to generate file this issue also relate to xpath issue |
antlrantlr4 | bailerrorstrategy in javascript | Bug | I m work with antlr 4 6 and the javascript target I m wonder if a bailerrorstrategy exist in javascript too I try something like this parser errhandler new antlr4 error bailerrorstrategy but I get error when I m try to parse input error parsecancellationexception be not a constructor typeerror parsecancellationexception be not a constructor at bailerrorstrategy recover e masterthesis simplex electron node modules antlr4 error errorstrategy js 743 11 at simplexparser expression e masterthesis simplex electron src model simplex lang simplexparser js 2926 27 at simplexparser expression e masterthesis simplex electron src model simplex lang simplexparser js 2840 46 at simplexparser assignmentstatement e masterthesis simplex electron src model simplex lang simplexparser js 1597 33 at simplexparser statement e masterthesis simplex electron src model simplex lang simplexparser js 1215 34 at simplexparser typeless e masterthesis simplex electron src model simplex lang simplexparser js 619 18 at simplexparser simplex e masterthesis simplex electron src model simplex lang simplexparser js 343 18 at simplexcompiler parse e masterthesis simplex electron src model compiler slx simplexcompiler js 42 29 be I miss something be the bailerrorstrategy not available in javascript |
antlrantlr4 | unable to resolve arrayinitlexer and arrayinitparser in definitive antlr4 book | Question | before submit an issue to antlr please check off these box x I be not submit a question on how to use antlr instead go to antlr4 discussion google group forum antlr discussion or ask at stackoverflow I have do a search of the exist issue to make sure I m not send in a duplicate cut when I try example arrayinit test java I be get an error with arrayinitlexer and arrayinitparser those be not include in org antlr v4 runtime or org antlr v4 runtime tree how do I solve the issue and make the code compile package sample import antlr s runtime librarie import org antlr v4 runtime import org antlr v4 runtime tree public class antlr test public static void main string args throw exception todo auto generate method stub create a charstream that read from standard input antlrinputstream input new antlrinputstream system in create a lexer that feed off of inputcharstream arrayinitlexer lexer new arrayinitlexer input create a buffer of tokens pull from the lexer commontokenstream tokens new commontokenstream lexer create a parser that feed off the tokens buffer arrayinitparser parser new arrayinitpars tokens parsetree tree parser init begin parse at init rule system out println tree tostringtree parser cut |
antlrantlr4 | dynamic query parse issue use antlr4 | Question | we be try to convert oracle pl sql to sql server t sql we be use the oracle grammar file as per the below url the pl sql block contain form a query dynamically like the example below exec stmt update dedupjobqueue set status complete where bank i d v bank i d and orgkey sorgkey and jobid jobid the translation to t sql construct be have some issue the result be break down incorrectly as mention below have a close look at the semicolon in between the dynamic query set exec stmt update corpnegativejobqueue set status complete where bank i d v bank i d and corp key sorgkey and jobid jobid it should have do it as below set exec stmt update corpnegativejobqueue set status complete where bank i d v bank i d and corp key sorgkey and jobid jobid can someone help in suggest if the grammar need to be change to handle it and any other pointer |
antlrantlr4 | python2 bug in intervalset py removeone cause exception when take complement | Bug | sorry for not include code right off but this look like an obvious bug with an obvious fix in the removeone function in runtime python2 src antlr4 intervalset py in the last elif case a range be use instead of an interval this cause a type error later on where an interval be expect instead of a list self interval k range v 1 I stop should be self interval k interval v 1 I stop |
antlrantlr4 | explain I array2dhashset | Question | hello in atnconfigset configlookup l77 be type of array2dhashset in other word a set of array however getoraddimpl l83 use the same comparatorequality in set and in array bucket so for I we only can have a set of array with one element so I can a set be sufficient do I miss a subtlety of java language or I be right |
antlrantlr4 | commontoken object have no attribute stopindex in python 2 3 | Bug | python code consider the following python3 code and custom grammar separate python import sys from antlr4 import from separatedlexer import separatedlexer from separatedparser import separatedparser def main argv code open text r read codestream inputstream code lexer separatedlexer codestream token lexer getalltoken tokenssource listtokensource listtokensource token tokensstream commontokenstream tokenssource tokensstream commontokenstream lexer use this statement to overcome the bug parser separatedparser tokensstream tree parser rule1 print tree tree tostringtree recog parser if name main main sys argv it s not work properly the follow error occur error traceback most recent call last file main py line 20 in main sys argv file main py line 16 in main tree parser rule1 file separatedparser py line 122 I n rule1 localctx t1 self a file separatedparser py line 326 I n a self match separatedpars a file parser py line 113 in match self consume file parser py line 329 in consume self getinputstream consume file bufferedtokenstream py line 99 in consume if self sync self index 1 file bufferedtokenstream py line 111 in sync fetch self fetch n file bufferedtokenstream py line 123 in fetch t self tokensource nexttoken file listtokensource py line 81 in nexttoken previousstop self token len self token 1 stopindex attributeerror commontoken object have no attribute stopindex java meanwhile the java code work good java string code readfile args 0 antlrinputstream codestream new antlrinputstream code separatedlexer lexer new separatedlexer codestream list extend token token lexer getalltoken listtokensource tokenssource new listtokensource token commontokenstream tokensstream new commontokenstream tokenssource separatedparser parser new separatedparser tokensstream parserrulecontext ast parser rule1 string stringtree ast tostringtree parser system out print tree stringtree so I be not able to parse the custom token list |
antlrantlr4 | please remove lexer from antlr | Duplicate | I suggest to remove lexer completely in next version of antlr lexer be just bad design and feature limited parser that run in the first pass I suggest to allow multiple pass of multiple parser and remove lexer as be miss function like characte region and regular expression should be move to parser |
antlrantlr4 | python 2 target s errorstrategy create problematic token | Bug | before submit an issue to antlr please check off these box x I be not submit a question on how to use antlr instead go to antlr4 discussion google group forum antlr discussion or ask at stackoverflow x I have do a search of the exist issue to make sure I m not send in a duplicate cut please include information about the expect behavior actual behavior and the small grammar or code that reproduce the behavior if appropriate please indicate the code generation target such as java c pointer into offend code region be also very welcome cut the python 2 runtime target produce problematic token during error recovery this issue be only see when you try to call node gettext on a node with a child error token in it the runtime error message be file antlr4 rulecontext py line 107 in gettext builder write child gettext typeerror unicode argument expect get str the fix be to prepend u to the string in the follow two line l487 l494 tokentext u now node gettext will no long throw an error and the error token text will show up in the result thank for your consideration |
antlrantlr4 | fix attributeerror when try to write an immutable variable in python | Bug | the removeone function of intervalset try to directly rewrite the start field of an immutable range variable when split an exist interval this cause attributeerror which be fix by the patch |
antlrantlr4 | tool how to generate a file per each child parserrulecontext | Question | hello I have read the stringtemplate documentation target java codegenpipeline java codegenerator java outputmodelcontroller java codegeneratorextension java despite all my effort I can not find what I need to do in target java I have add public boolean isoneclassperfile return false override in ctarget java by gettemplate getinstanceof oneclassperfile render equal true in codegenpipeline java process I have add st rulecontext gen generaterulecontext true duplication of gen generateparser true gen writerulecontext rulecontext true in codegenerator java I have add public void writerulecontext st outputfilest boolean header if gettarget isoneclassperfile todo for each rule function if gen gettarget needsheader gettarget genfile g outputfilest xxx context h gettarget genfile g outputfilest xxxx context c any help would be appreciate |
antlrantlr4 | what be the meaning of different value of invokingstate | Question | on page 269 of the definitive antlr 4 reference there be a code as follow public class csvparser extend parser public final rowcontext row string column throw recognitionexception rowcontext localctx new rowcontext ctx 4 column enterrule localctx rule row on page 270 of the definitive antlr 4 reference there be a code as follow public final acontext a map x int y throw recognitionexception acontext localctx new acontext ctx 0 x y enterrule localctx rule a be the 4 and 0 in the above code the value of invokingstate if yes what s the the meaning of different value of invokingstate thank |
antlrantlr4 | what s the meaning of input lt 1 | Question | on page 210 of the definitive antlr 4 reference there be a code as follow keyif input lt 1 gettext equal if i d can anyone tell I what s the meaning of input lt 1 thank |
antlrantlr4 | help need in antlr parse performance issue | Question | we be face issue with antlr performance for parse oracle file the oracle file for conversion have significant large size 17 24 38 mb file while build the parsetree it take a lot of time and memory its even give core oom dump we try disable the building of parse tree however that doesnot work as the walker doesn t go thru the file and generate a blank file we try to use bufferedinputstream in place of fileinoutstream we even try to use bufferedtokenstream unbufferedcharstream unbufferedtokenstream instead of the other respective or equivalent stream for parser and lexer none of the option be work and the parse tree be take a lot of memory and time to be generate and traverse we try run with 2 gig of heap memory as well however it go beyond that and give core oom dump from the online forum it seem this be a very common problem in antlr when it try to parse large input file as alterative it either suggest to break down the input file into multiple small file it also say that we can leave aside listener and visitor and create object directly in the grammer and use hashmap vector 26120662 have you encounter any such antlr problem in the past and if yes how be it handle any suggestion that would help in reduce the memory footprint and make the performance fast specific to antlr the input file mostly contain select and insert statement but these file be large volume insert into crmuser object config detail attribconfigid objconfigid attribname parentname isrequire isselecte readaccess writeaccess defaultlabel configlabel datatype iscomposite ismandatory attribsize attribrange attribvalue iswritable value 91933804 1682878 account extbo relative member i d account extbo n y f f account extbo relative member i d account extbo relative member i d string n n 50 null null n insert into crmuser object config detail attribconfigid objconfigid attribname parentname isrequire isselecte readaccess writeaccess defaultlabel configlabel datatype iscomposite ismandatory attribsize attribrange attribvalue iswritable value 91933805 1682878 account extbo eligibility criterion account extbo n y f f account extbo eligibility criterion account extbo eligibility criterion string n n 50 null null n |
antlrantlr4 | generate code work fine in java but hang forever in python 3 | Duplicate | hello I be parse sas code which at a specific situation it have a possibility of write single line comment this be a comment the thing be this may also happen v 5 29 the 29 be a multiplication not a comment but this be a comment so I create this line comment grammar identifier line comment r n r n channel hide which work fine when run grun tool to see the tree use java code but run through python3 generate code I get extraneous input expect for the piece of text n hello world not sure what s go on thank saif |
antlrantlr4 | consider introduce an error code property to recognitionerror | Question | our team be face a very basic problem with antlr4 we need to throw exception for specific syntax error but we need to identify each of theses error we can not just extend the class add a error code because it need to be do at the root class the recognitionerror once antlr use error not only to tell that a error happen but also as a signal to trigger action accord to the error we re unable to create our own root exception we believe it s a good ideia to add a code property to the recognitionerror class it s a backward compatible change that would make error catch much more clean parrt if you agree we would be glad to submit a pr |
antlrantlr4 | antlr4 unable to identify parse multi line sql comment | Question | I be use antlr4 for parse oracle grammer I be try to read oracle file plsql as input and convert it to equivalent t sql construct I have use the grammer file for plsql present in github the exact grammar which address multiple line and single line comment be single line comment r n newline eof channel hide multi line comment channel hide or single line comment r n newline eof skip multi line comment skip the issue be there with multi line comment there be 2 issue that I be face when my input be in the below format its not skip it with either of the above grammar I want my target t sql file should maintain the same text as output format on 7 15 2015 5 37 14 pm qp5 v5 163 1008 3004 anything when my input be in the below format its give the error as mention below format on 7 15 2015 5 37 14 pm qp5 v5 163 1008 3004 author anyname anything I get the error as exception not able to parse org antlr v4 runtime misc parsecancellationexception line 3 8 no viable alternative at input anyname I be new to antlr and I see a lot of people have report this error however I be unable to get a proper resolution on the error any pointer and help would be greatly appreciate |
antlrantlr4 | to improve language translation | Question | in defaulterrorstrategy class we have message for error but for two function they have no expection raise protect void reportunwantedtoken parser recognizer if inerrorrecoverymode recognizer return beginerrorcondition recognizer token t recognizer getcurrenttoken string tokenname gettokenerrordisplay t intervalset expect getexpectedtoken recognizer string msg extraneous input tokenname expect expect tostre recognizer getvocabulary recognizer notifyerrorlistener t msg null no exception protect void reportmissingtoken parser recognizer if inerrorrecoverymode recognizer return beginerrorcondition recognizer token t recognizer getcurrenttoken intervalset expect getexpectedtoken recognizer string msg miss expect tostre recognizer getvocabulary at gettokenerrordisplay t recognizer notifyerrorlistener t msg null no exception be it possible to have new exception for this two function for language error translation text it s well to have the same result as reportinputmismatch for example |
antlrantlr4 | go target generate code for java g4 grammar doesn t compile | Bug | before submit an issue to antlr please check off these box I be not submit a question on how to use antlr instead go to antlr4 discussion google group forum antlr discussion or ask at stackoverflow I have do a search of the exist issue to make sure I m not send in a duplicate expect behavior antlr4 dlanguage go java g4 should generate go code that compile java g4 be take from github com antlr grammar v4 other info antlr4 command be alias antlr4 java xmx500 m cp home ereyes m2 repository org antlr antlr4 4 6 snapshot antlr4 4 6 snapshot jar classpath org antlr v4 tool go version go version go1 7 1 linux amd64 actual behavior the generate code do not compile here s what the go compiler say go install home ereyes code antlr4 java parser java lexer go 726 syntax error unexpected input expect comma or java lexer go 739 syntax error unexpected input expect comma or step to reproduce the behavior cd code git clone mkdir p antlr4 java src parser export gopath home code antlr4 java cd antlr4 java src parser cp code grammar v4 java java g4 antlr4 dlanguage go java g4 go get github com antlr antlr4 runtime go antlr go install I look at the error and attempt to fix by apply the patch below but it still doesn t fix the problem diff git a java lexer go b java lexer go index b7b70c6 4b5114f 100644 a java lexer go b java lexer go 723 7 723 7 func p javalexer javaletter sempre localctx antlr rulecontext predindex int return character isjavaidentifierstart input la 1 case 1 return character isjavaidentifierstart character tocodepoint char input la 2 char input la 1 return character isjavaidentifierstart character tocodepoint char input la 2 char input la 1 default panic no predicate with index fmt sprint predindex 736 7 736 7 func p javalexer javaletterordigit sempre localctx antlr rulecontext predin return character isjavaidentifierpart input la 1 case 3 return character isjavaidentifierpart character tocodepoint char input la 2 char input la 1 return character isjavaidentifierpart character tocodepoint char input la 2 char input la 1 default panic no predicate with index fmt sprint predindex I try to fix the parenthesis in the cast in java lexer go I also wonder if the intention be to cast to rune instead of char which isn t a build in type in go anyways here be the compiler error after apply this patch java lexer go 723 undefined character in character isjavaidentifierstart java lexer go 723 undefined input in input la java lexer go 726 undefined character in character isjavaidentifierstart java lexer go 726 undefined char java lexer go 726 undefined input in input la java lexer go 726 undefined char java lexer go 726 undefined input in input la java lexer go 736 undefined character in character isjavaidentifierpart java lexer go 736 undefined input java parser go 14393 no new variable on leave side of java lexer go 736 too many error and after change char to rune java lexer go 723 undefined character in character isjavaidentifierstart java lexer go 723 undefined input in input la java lexer go 726 undefined character in character isjavaidentifierstart java lexer go 726 undefined input in input la java lexer go 736 undefined character in character isjavaidentifierpart java lexer go 736 undefined input in input la java lexer go 739 undefined character in character isjavaidentifierpart java lexer go 739 undefined input in input la java parser go 14393 no new variable on leave side of |
antlrantlr4 | mvn compile fail could not resolve dependency | Bug | just try to compile antlr locally on macos sierra 10 12 1 follow this doc this be the end of the mvn compile run info info building antlr 4 tool test 4 6 snapshot info info info reactor summary info info antlr 4 success 0 759 s info antlr 4 runtime success 5 714 s info antlr 4 tool success 1 896 s info antlr 4 maven plugin success 2 277 s info antlr 4 runtime test annotation success 0 014 s info antlr 4 runtime test processor success 0 014 s info antlr 4 runtime test 2nd generation success 1 357 s info antlr 4 tool test failure 0 018 s info info build failure info info total time 12 323 s info finish at 2016 11 20t16 42 17 01 00 info final memory 38 m 431 m info error fail to execute goal on project antlr4 tool testsuite could not resolve dependency for project org antlr antlr4 tool testsuite jar 4 6 snapshot the follow artifact could not be resolve org antlr antlr4 runtime testsuite jar test 4 6 snapshot org antlr antlr4 jar test 4 6 snapshot failure to find org antlr antlr4 runtime testsuite jar test 4 6 snapshot in be cache in the local repository resolution will not be reattempte until the update interval of sonatype nexus snapshot have elapse or update be force help 1 error error to see the full stack trace of the error re run maven with the e switch error re run maven use the x switch to enable full debug log error error for more information about the error and possible solution please read the follow article error help 1 error error after correct the problem you can resume the build with the command error mvn rf antlr4 tool testsuite all help apreciate |
antlrantlr4 | issue with antlr4 java 7 grammar expression parser rule | Question | I find this issue for the follow input public string publishabsencesapprovalsevent map absencevalue inside this method there be a pretty much long string which span around 150 line when I try to create a parsetree for this input file it s get hang like forever I guess there be a decision make issue for the grammar for the below two rule typeargument typeargument typeargument expression many alternative expression expression logical when I comment out the logical alternative and re run it s work I guess there be a token matching decision from lexer to parser level which make it hang forever please let I know if there be a solution for this without alter much of the grammar file |
antlrantlr4 | parse slow like any thing | Question | in my source file I have a string like this string span across around 200 line string payload transactionid requestor org apache commons lang stringescapeutils escapexml personname org apache commons lang stringescapeutils escapexml absencetype absencestartdate absenceenddate absencestatuscd submitteddate startdate more similar line to constitute the variable when I have try to create a parsetree for the source file it take like around 5 hour to complete the process I have try the unbufferedtoken char stream but nothing as of now do not work I guess the major issue be because of an expression rule get nest recursively so that the parser be get insane please let I know if there be any possible solution exist for this |
antlrantlr4 | array2dhashset clear do not reset threshold | Bug | currently the implementation of array2dhashset clear do not set the value of the threshold field if one of these set be reuse after call clear it s likely that a large number of hash collision will occur when the set be use again |
antlrantlr4 | return directive generate improper c code | Bug | hi I be test one of the example of book the the definitive antlr4 reference which be in page 183 185 the code I write be grammar attr1 parser rule file local int I 0 hdr row row hdr text split I hdr row null row string column return dictionary value local int col 0 init value new dictionary after if value null value count 0 console writeline value value field if column null value add column col trim field text trim field if column null value add column col trim field text trim r n field text string lexer rule text n r string the problem be with the return directive of the row rule return dictionary value it generate in visual studio 2015 the follow improper code I have already test a lot of thing but it still doesn t work in place of the value identifier for the dictionary it generate a list of c s reserve word this behaviour happen only for the identifi value if I use another name such as xxxx it work be it a bug or be I write something wrong in the grammar description public partial class rowcontext parserrulecontext public string column public dictionary struct extern do ushort float while operator ref protect readonly continue else check lock catch if case new use static void in sizeof byte double seal finally this unchecked be param enum explicit as null true fix try decimal object implicit internal private virtual bool const string for interface unsafe long out switch delegate foreachkey ulong goto public stackalloc override event class typeof break false volatile abstract uint int throw char namespace sbyte short return base public int col 0 public fieldcontext field |
antlrantlr4 | exprlexer exprparser not find | Question | hi I create maven project with dependency antlr4 antlr4 runtime and plugin antlr4 maven plugin in intellij idea but when I try to run simple application like public class application public static void main string args throw exception antlrstringstream in new antlrfilestream d java antlr src main java dev nigredo run s exprlexer lexer new exprlexer in commontokenstream tokens new commontokenstream lexer exprparser parser new exprparser token parser eval compiler can not see class exprlexer and expparser how to fix this problem |
antlrantlr4 | xpathlexer java miss from src | Question | when compile antlr4 master runtime java src I get the follow compilation error antlr4 master runtime java src org antlr v4 runtime tree xpath xpath java error 87 17 java can not find symbol symbol class xpathlexer location class org antlr v4 runtime tree xpath xpath |
antlrantlr4 | update python target md | Bug | add miss import statement for sys |
antlrantlr4 | how I can get the number of line and column for each token in antlr4 | Question | I be new with antlr4 I search a lot to get number of line and column for each token in antlr4 I have a well knewoleadge on flex and bison and I make a complete compiler for php with flex and bison in flex and bison I be get the number of line and column by a simple code in bison y I define struct struct r int I float f char c char str int mylineno int mycolno r namespace name part rule t string new var dec 1 1 1 and in flex l I write int lineno 1 int colno 1 while yylval r mylineno lineno yylval r mycolno colno colno strlen yytext return t while this way I can get the line of number and column with flex and bison note I need the line of number and column for print my own type check error so can help I to get the number of line and column for each token in antlr4 |
antlrantlr4 | how to build visitor to visit and print ast with antlr 4 | Question | I build ast for my grammar expression with antlr 4 by eclipse and I want to build visitor to visit the ast and print the ast how I can build visitor hello g4 define a grammar call hello grammar hello parser header import java util map import java util hashmap import java util list import java util arraylist import ast parser member map symboltable new hashmap r program i d bracket open list body new arraylist sentence body add sentence node bracket close for astnode n body n excute match keyword hello follow by an identifi sentence return astnode node println node println node println return astnode node println expression semicolon node new println expression node expression return astnode node t1 factor node t1 node plus t2 factor node new addition node t2 node minus t2 factor node new sub node t2 node factor return astnode node t1 term node t1 node mult t2 term node new multiplication node t2 node div t2 term node new div node t2 node term return astnode node number node new constant integer parseint number text i d par open expression node expression node par close program program var var println println int int double double string string mult plus minus div assign bracket open bracket close par open par close semicolon i d a za z a za z0 9 match low case identifier number 0 9 ws t r n skip skip space tab newline astnode interface package ast public interface astnode public object excute for example additional class package ast public class addition implement astnode private astnode operand1 private astnode operand2 public addition astnode operand1 astnode operand2 super this operand1 operand1 this operand2 operand2 override public object excute todo auto generate method stub return int operand1 excute int operand2 excute main class import java io ioexception import org antlr v4 runtime import org antlr v4 runtime tree import java io import javax servlet requestdispatcher import javax servlet servletexception import javax servlet http httpservlet import javax servlet http httpservletrequ import javax servlet http httpservletresponse servlet implementation class myservlet public class myservlet extend httpservlet private static final long serialversionuid 1l see httpservlet httpservlet public myservlet super todo auto generate constructor stub see httpservlet doget httpservletrequest request httpservletresponse response protect void doget httpservletrequ request httpservletresponse response throw servletexception ioexception dopost request response protect void dopost httpservletrequest request httpservletresponse response throw servletexception ioexception try string comment request getparameter preview form comment request setattribute data comment antlrinputstream input new antlrinputstream comment hellolexer lexer new hellolexer input commontokenstream tokens new commontokenstream lexer helloparser parser new helloparser token lexer removeerrorlistener consoleerrorlistener instance parser removeerrorlistener consoleerrorlistener instance parsetree tree parser r begin parse at rule r hellovisitor visitor new hellovisitor response setcontenttype text html printwriter writer response getwriter requestdispatcher rd request getrequestdispatcher index jsp rd include request response writer println your comment be antlrinputstream input new antlrinputstream system in writer println comment writer println tree tostringtree parser writer close catch exception exception exception printstacktrace |
antlrantlr4 | strange code in javascript predictioncontext js line 191 | Bug | hi I search some way for optimization in antlr for javascript and find one strange line in code l191 I research like singletonpredictioncontext class implement I don t sure but singletonpredictioncontext doesn t have property empty return state always because predictioncontext call this hashstre l136 doesn t give this property to singletonpredictioncontext call this doesn t translate property from prototype to child need to use object create or predictioncontext empty return state in line 191 for this do it a bug or mistake or typo |
antlrantlr4 | parenthesis expression not return expect result | Duplicate | I m test this antlr grammar with version 4 5 3 and with the input 1 1 but the result be not the expect one be this a bug or do I make a mistake antlr grammar from tour chapter augment with action grammar expr header import java util parser member map variable new hashmap parse return object v command eof v command v command return object v lbrace command rbrace v command v expr v expr v cond v cond b declare v declare v string v string s declare return object v number field n expr v n v variable put number field text n v bool field b cond v b b variable put bool field text b b string field s string v s text variable put string field text s text string return string s string s string text i d string field s variable containskey i d text string variable get i d text expr return double v l expression analyser sera soit une addition une soustraction une multiplication ou une division a expr product b expr v a v b v a expr div b expr v a v b v a expr plus b expr v a v b v a expr minus b expr v a v b v minus number v double parsedouble number text number v double parsedouble number text i d number field v double variable containskey i d text variable get i d text 0 0 cond return boolean b boolean expresion ea expr gt ez expr b ea v ez v ea expr ge ez expr b ea v ez v ea expr lt ez expr b ea v ez v ea expr le ez expr b ea v ez v ea expr eq ez expr b ea v ez v sa string eq sb string b sa s equal sb s not cond b cond b a cond and z cond b a b z b a cond or z cond b a b z b true b true false b false i d bool field b boolean variable containskey i d text variable get i d text false comparator gt ge lt le eq binary and or bool true false and and or or not not true true false false gt ge lt le eq plus minus product div lbrace rbrace number 0 9 0 9 esc seq b t n f r string esc seq bool field b a z a z a z 0 9 number field d a z a z a z 0 9 string field a z a z a z 0 9 ws cette r gle permet de reconna tre les espacement t r n n skip ne pas consid rer ce espacement comme token my java test code be java system out println start expr console string inputfile null if args length 0 inputfile args 0 inputstream be system in if inputfile null be new fileinputstream inputfile bufferedreader br new bufferedreader new inputstreamreader be string expr br readline get first expression int line 1 track input expr line number exprpars parser new exprparser null share single parser instance parser setbuildparsetree false don t need tree while expr null while we have more expression create new lexer and token stream for each line expression antlrinputstream input new antlrinputstream expr n exprlexer lexer new exprlexer input lexer setline line notify lexer of input position lexer setcharpositioninline 0 commontokenstream tokens new commontokenstream lexer parser setinputstream token notify parser of new token stream parser getbuildparsetree exprparser parsecontext parsectx parser parse system out println parsectx tostringtree parser start the parser and print result system out printf 70 s n expr parsectx v expr br readline see if there s another line line |
antlrantlr4 | a bug of the antlr4 python3 runtime 4 5 3 | Bug | in the file intervalset py the statement at line 147 be I start v 1 in which the variable I be of type range so its member start be readonly maybe it can be replace by self interval self interval index I range v 1 I stop |
antlrantlr4 | not skip white pace in lexical rule | Question | hey I m new in antlr and I have a problem with a white space in a lexer rule I m use antlr4 and write this test grammar grammar resturant option language java startrule reservation eof reservation drink drink furitshake water furitshake bulidinshake customfruitshake ws t r n skip bulidinshake straberry banana mango banana mango banana melon customfruitshake mango banana melon watermelon straberry mango m a n g o banana b a n a n a melon m e l o n watermelon w a t e r m e l o n straberry s t r a b e r r y milk m I l k icecream I c e c r e a m water w a t e r fragment a a a fragment b b b fragment c c c fragment d d d fragment e e e fragment f f f fragment g g g fragment h h h fragment I I I fragment j j j fragment k k k fragment l l l fragment m m m fragment n n n fragment o o o fragment p p p fragment q q q fragment r r r fragment s s s fragment t t t fragment u u u fragment v v v fragment w w w fragment x x x fragment y y y fragment z z z fragment digit 0 9 fragment letter a za z fragment alphabeticletter a za z when I try to run the program the text input mango banana melon I excpecte that the rule how will capture my input will be bulidinshake but inste the one how capture the input be customfruitshake when I try to change the rule bulidinshake and add space between the word bulidinshake straberry banana mango banana mango banana melon I captue the bulidinshake I do not undestand why this be happen if I add a rule to skip white space ws t r n skip do it mean that I will need to add space between any of my lexical rule if I want to combo they one after the other |
antlrantlr4 | repalce string exception in python target | Bug | raise string exception in python be not support predictioncontext getreturnstate attempt this what be fix by the patch |
antlrantlr4 | many test fail on window due to invalid path | Bug | update I m retitle this issue to reflect the fact it be a bug and not just lack of understanding see pr 1268 for detail on the bug I m try to setup so I can contribute to the antlr project by follow the instruction for build antlr4 from source on a window 10 machine I initially start with how to build antlr itself but that page seem hopelessly out of date reference python scripts bild py etc the separate page building antlr seem more up to date perhaps the old one should be delete I think I ve instal all the needed pre requisite include jdk 1 8 0 101 maven 3 3 9 node js v6 3 1 and mono 4 4 42 none the less while compile succeed many test in java and the mono c be fail while I m a long time c dev I m used to microsoft s tool and both mono and java be a bit unfamiliar to I I m hope I can get someone to review the test failure and give I a hint how to address they update some of the problem may have be due to have pythong 2 7 rather than 3 5 instal can someone please help out with a complete list of build test dependency get the source problem start right away with the git command as document c tmp git clone antlr antlr4 git cloning into antlr4 permission deny publickey fatal could not read from remote repository please make sure you have the correct access right and the repository exist I m no git wizard but antlr antlr4 git look funny the follow seem to work much well be this equivalent c tmp git clone clone into antlr4 remote counting object 61480 do remote total 61480 delta 0 reuse 0 delta 0 pack reuse 61480 receive object 100 61480 61480 31 24 mib 7 18 mib s do resolve delta 100 32970 32970 do check connectivity do check out file 100 1427 1427 do compile this seem to go well I ll attach the log for completeness because I run into problem later but I see no warning or error compile txt testing tool and target this be where I run into problem install txt there be a few preliminary warning I m unsure how to interpret but the first outright failure seem to be these t e s t s run org antlr v4 test runtime csharp testcompositelexer dir c user burt appdata local temp testcompositelexer 1470877266905 dir c user burt appdata local temp testcompositelexer 1470877267468 test run 2 failure 2 error 0 skip 0 time elapse 0 687 sec failure testlexerdelegatorinvokesdelegaterule org antlr v4 test runtime csharp testcompositelexer time elapse 0 565 sec failure java lang assertionerror expect 1 0 1 1 1 b 1 1 1 2 2 2 c 4 1 2 3 3 2 1 1 3 but be at org junit assert fail assert java 88 at org junit assert failnotequal assert java 743 at org junit assert assertequal assert java 118 at org junit assert assertequals assert java 144 at org antlr v4 test runtime csharp baset assertequal basetest java 859 at org antlr v4 test runtime csharp testcompositelexer testlexerdelegatorinvokesdelegaterule testcompositelexer java 29 at sun reflect nativemethodaccessorimpl invoke0 native method at sun reflect nativemethodaccessorimpl invoke nativemethodaccessorimpl java 62 at sun reflect delegatingmethodaccessorimpl invoke delegatingmethodaccessorimpl java 43 at java lang reflect method invoke method java 498 at org junit runner model frameworkmethod 1 runreflectivecall frameworkmethod java 47 at org junit internal runner model reflectivecallable run reflectivecallable java 12 at org junit runner model frameworkmethod invokeexplosively frameworkmethod java 44 at org junit internal runner statement invokemethod evaluate invokemethod java 17 at org junit internal runner statement runbefore evaluate runbefore java 26 at org junit rule testwatcher 1 evaluate testwatcher java 55 at org junit rule runrule evaluate runrule java 20 at org junit runner parentrunner runleaf parentrunner java 271 at org junit runner blockjunit4classrunner runchild blockjunit4classrunner java 70 at org junit runner blockjunit4classrunner runchild blockjunit4classrunner java 50 at org junit runner parentrunner 3 run parentrunner java 238 at org junit runner parentrunner 1 schedule parentrunner java 63 at org junit runner parentrunner runchildren parentrunner java 236 at org junit runner parentrunner access 000 parentrunner java 53 at org junit runner parentrunner 2 evaluate parentrunner java 229 at org junit runner parentrunner run parentrunner java 309 at org apache maven surefire junit4 junit4provider execute junit4provider java 252 at org apache maven surefire junit4 junit4provider executetestset junit4provider java 141 at org apache maven surefire junit4 junit4provider invoke junit4provider java 112 at sun reflect nativemethodaccessorimpl invoke0 native method at sun reflect nativemethodaccessorimpl invoke nativemethodaccessorimpl java 62 at sun reflect delegatingmethodaccessorimpl invoke delegatingmethodaccessorimpl java 43 at java lang reflect method invoke method java 498 at org apache maven surefire util reflectionutil invokemethodwitharray reflectionutil java 189 at org apache maven surefire booter providerfactory providerproxy invoke providerfactory java 165 at org apache maven surefire booter providerfactory invokeprovider providerfactory java 85 at org apache maven surefire booter forkedbooter runsuitesinprocess forkedbooter java 115 at org apache maven surefire booter forkedbooter main forkedbooter java 75 testlexerdelegatorruleoverridesdelegate org antlr v4 test runtime csharp testcompositelexer time elapse 0 1 sec failure java lang assertionerror expect 1 0 1 2 1 1 1 2 but be at org junit assert fail assert java 88 at org junit assert failnotequal assert java 743 at org junit assert assertequal assert java 118 at org junit assert assertequals assert java 144 at org antlr v4 test runtime csharp baset assertequal basetest java 859 at org antlr v4 test runtime csharp testcompositelexer testlexerdelegatorruleoverridesdelegate testcompositelexer java 57 at sun reflect nativemethodaccessorimpl invoke0 native method at sun reflect nativemethodaccessorimpl invoke nativemethodaccessorimpl java 62 at sun reflect delegatingmethodaccessorimpl invoke delegatingmethodaccessorimpl java 43 at java lang reflect method invoke method java 498 at org junit runner model frameworkmethod 1 runreflectivecall frameworkmethod java 47 at org junit internal runner model reflectivecallable run reflectivecallable java 12 at org junit runner model frameworkmethod invokeexplosively frameworkmethod java 44 at org junit internal runner statement invokemethod evaluate invokemethod java 17 at org junit internal runner statement runbefore evaluate runbefore java 26 at org junit rule testwatcher 1 evaluate testwatcher java 55 at org junit rule runrule evaluate runrule java 20 at org junit runner parentrunner runleaf parentrunner java 271 at org junit runner blockjunit4classrunner runchild blockjunit4classrunner java 70 at org junit runner blockjunit4classrunner runchild blockjunit4classrunner java 50 at org junit runner parentrunner 3 run parentrunner java 238 at org junit runner parentrunner 1 schedule parentrunner java 63 at org junit runner parentrunner runchildren parentrunner java 236 at org junit runner parentrunner access 000 parentrunner java 53 at org junit runner parentrunner 2 evaluate parentrunner java 229 at org junit runner parentrunner run parentrunner java 309 at org apache maven surefire junit4 junit4provider execute junit4provider java 252 at org apache maven surefire junit4 junit4provider executetestset junit4provider java 141 at org apache maven surefire junit4 junit4provider invoke junit4provider java 112 at sun reflect nativemethodaccessorimpl invoke0 native method at sun reflect nativemethodaccessorimpl invoke nativemethodaccessorimpl java 62 at sun reflect delegatingmethodaccessorimpl invoke delegatingmethodaccessorimpl java 43 at java lang reflect method invoke method java 498 at org apache maven surefire util reflectionutil invokemethodwitharray reflectionutil java 189 at org apache maven surefire booter providerfactory providerproxy invoke providerfactory java 165 at org apache maven surefire booter providerfactory invokeprovider providerfactory java 85 at org apache maven surefire booter forkedbooter runsuitesinprocess forkedbooter java 115 at org apache maven surefire booter forkedbooter main forkedbooter java 75 any guidance would be appreciate |
antlrantlr4 | bug format attribute seem not work properly no effect | Question | hello in stg template there be while occurrence than generate while la select in my case I need to generate while la sql symbol select where sql be symbol be a constant and select be varname can anyone help I to fix my problem |
antlrantlr4 | empty alternative in rule cause syntax error in parser py for python2 3 target | Bug | sample grammar grammar test token i d root i d semi eof semi ws t r n skip this generate follow snippet in testparser py for python2 and 3 if token in systemrdlparser i d self state 2 self match systemrdlparser i d elif token in systemrdlparser semi else raise noviablealtexception self here elif be empty result in syntax error maybe pass be miss |
antlrantlr4 | fix the initialization of conflictingalt in execatn in python target | Bug | the java target initialize the conflictingalt local variable base on the conflictingalt property of the target state however the python target reset it to none the patch make the initialization consistent |
antlrantlr4 | fix the type hint of semanticcontext filterprecedencepredicate parameter | Bug | semanticcontext filterprecedencepredicate take a set as parameter in python3 but the hint tell list instead the patch fix this |
antlrantlr4 | fix eoftoken access in listtokensource nexttoken by python target | Bug | at the end of the nexttoken function set the eoftoken field be attempt without the self keyword result in access and set a new local and unused variable the patch supplement the miss self keyword for both target |
antlrantlr4 | python2 api be too slow | Question | ncall tottime percall cumtime percall filename lineno function 1089345 11806 3 142 0 000 14 203 0 001 antlr4 atn parseratnsimulator py 1163 closure 1127090 1 653 0 000 1 653 0 000 antlr4 atn atnconfig py 45 init 1542899 1 401 0 000 5 097 0 000 antlr4 atn parseratnsimulator py 1232 getepsilontarget 1115917 11806 1 315 0 000 14 222 0 001 antlr4 atn parseratnsimulator py 1121 closurecheckingstopstate 2100131 986037 0 976 0 000 1 728 0 000 hash 4222077 0 868 0 000 0 868 0 000 isinstance 836337 0 831 0 000 2 072 0 000 antlr4 atn parseratnsimulator py 1223 470116 0 733 0 000 3 863 0 000 antlr4 atn atnconfigset py 92 add 470116 0 722 0 000 2 743 0 000 antlr4 atn atnconfigset py 117 getoradd 552 0 411 0 001 0 607 0 001 antlr4 atn predictionmode py 497 getconflictingaltsubset 527777 261858 0 399 0 000 0 444 0 000 antlr4 predictioncontext py 159 eq 199665 0 369 0 000 0 634 0 000 antlr4 atn atnconfig py 83 eq 536913 0 322 0 000 1 205 0 000 antlr4 atn atnconfig py 95 hash 2350555 0 295 0 000 0 398 0 000 method get of dict object |
antlrantlr4 | gettext method with argument not always work correctly | Bug | I create commontokenstream from list of token by the following way java list extend token preprocessortoken list lexer getalltoken listtokensource codetokensource new listtokensource token commontokenstream tokensstream new commontokenstream codetokensource after it I try to call method gettext context for rulecontext but it return a wrong result java tokensstream gettext context return incorrect text only text of first token tokensstream gettext return correct text of all token if fill method be call before gettext method these method return a correct text java tokensstream fill tokensstream gettext context return correct text of token from context tokensstream gettext return correct text of all token |
antlrantlr4 | sll mode disambiguation performance | Duplicate | as outline in 994 some grammar have a bad timing behavior when use with antl4 as 994 recommend a two phase strategy should be use in this case the follow grammar be a badly behave grammar even use two phase strategy see grammar numexpr numexpr if statement eof if statement if part else part endif if part if expr statement list if expr else part else statement list else statement list statement statement if statement expr i d value not expr expr expr expr and expr expr or expr expr between expr and expr value 0 9 i d a za z a za z 0 9 ws t n r f skip error I ll elaborate more on stackoverflow see |
antlrantlr4 | use antlr4 v4 5 3 to parse a java file that have more than 3000 line give out of memory error | Duplicate | although increase the heap size help I m just wonder if there be a way to optimize the memory usage |
antlrantlr4 | grammar with bailerrorstrategy accept invalid input extra semicolon | Question | I have a grammar with a start rule that parse an expression follow by eof for this bug report I simplify the expression grammar to just the name rule antlr start expression eof expression name period name identifi period identifi identifi i d etc I configure the parser with bailerrorstrategy I do not want to allow any input which be not match so no automatic recovery the test case verify that some invalid input do not parse such as a b abc etc however the input a be accept and should not be the semicolon should not be allow antlr ignore it the grammar and junit test and gradle build be in the attached tar file to build test extract the zip antlr defect zip file cd into the source directory and run the test use gradle you can also run your own install of gradle instead of gradlew if you prefer unzip antlr defect tar cd antlr defect gradlew test or gradle test to run your own install of gradle the build fail open build report test index html to see the error cause by java lang assertionerror 2 no parse failure on input a invalid name this be run antlr 4 5 3 see the build gradle file for the dependency |
antlrantlr4 | java tokenize and | Question | hi in java8 there be two token shift right and two s if I define as shift right then I can t have rule generictype type type consider this 1 2 be match correctly typea typeb typec type which match a but really should be see as two s after read java8 g4 I find the follow line shiftexpression additiveexpression shiftexpression additiveexpression shiftexpression additiveexpression shiftexpression additiveexpression which be not correct because it allow thing like a b which javac report error while expect a b there seem no way around it if I have define antlr4 win t try to re interpret as two s even if not do so would cause overall grammar match to fail can you guy upgrade antlr4 to support lexer backtrack basically if overall match be a failure try to use small lengthed token I m new to parse and all but I find c 11 and java8 all support this wonder if it s very hard to implement this in antlr4 I do understand lexe stage will only return the long match which be but why can t we break it down into two s in parse stage the follow way can work around this problem but be very ugly 1 define shift right as and check if any blank be present between s in code 2 define generic as type type type type type |
antlrantlr4 | performance issue | Duplicate | dear sir I be use the oracle plsql g4 grammar available from here the code be generate use antlr 4 5 3 complete jar for a python 2 target visitor dlanguage python2 with the attach sql test file pcr in out detect release sql it appear that use the trace the analyzer freeze several time around the follow rule enter table ref aux lt 1 hence it take more than 50 second to parse it condition be 1 parser interp predictionmode predictionmode ll 2 usage of a specific error listener I have also try 1 the two level stage sll then ll parse without conclusive result 2 predictionmode ll exact ambig detection could you help thank in advance robert plsql test file sql txt |
antlrantlr4 | help understanding expect alt 1 n but be test failure | Question | any tip for what might be cause the error below this be from the go language target I m work on I haven t debug it deeply yet but be hope this might have a well know cause testambiguitynoloop org antlr v4 test runtime go testfullcontextparse time elapse 2 271 sec failure org junit comparisonfailure expect alt 1 but be at org junit assert assertequal assert java 115 at org junit assert assertequals assert java 144 at org antlr v4 test runtime go testfullcontextparse testambiguitynoloop testfullcontextparse java 55 at sun reflect nativemethodaccessorimpl invoke0 native method at sun reflect nativemethodaccessorimpl invoke nativemethodaccessorimpl java 62 at sun reflect delegatingmethodaccessorimpl invoke delegatingmethodaccessorimpl java 43 at java lang reflect method invoke method java 498 at org junit runner model frameworkmethod 1 runreflectivecall frameworkmethod java 47 at org junit internal runner model reflectivecallable run reflectivecallable java 12 at org junit runner model frameworkmethod invokeexplosively frameworkmethod java 44 at org junit internal runner statement invokemethod evaluate invokemethod java 17 at org junit internal runner statement runbefore evaluate runbefore java 26 at org junit rule testwatcher 1 evaluate testwatcher java 55 at org junit internal runner statement failontimeout statementthread run failontimeout java 74 |
antlrantlr4 | javascript target can t use wildcard | Bug | the javascript target compile to matchwildcard instead of this matchwildcard which raise an error manually change to this matchwildcard in the generate source seem to fix the problem |
antlrantlr4 | null | Question | I be use antlr in python java jar antlr jar file dlanguage python2 java8 g4 show error message in grammar I fix it after it in java8lexer py it show char undefine I change it to chr and fix it also but when run it for my file it show I think it be unable to read copyright symbol unexpected error |
antlrantlr4 | the demo code expr g4 in tpantlr2 code zip for antlr4 have one error | Duplicate | if you test the expression 3 4 5 you will get the result 0 why the code e v e v should modefie as a e v a v you will get the result 27 |
antlrantlr4 | installation over http be unsafe | Question | hi antlr look great but the recommend download happen over http be a bad idea isn t it for the home page curl o |
antlrantlr4 | update python target md | Bug | update documentation so that python example will work example mygrammar have a lexer rule startrule as the root this should be change to parser rule startrule |
antlrantlr4 | fix initialization of atnconfig when compute sll prediction termination condition | Bug | the predictionmode hassllconflictterminatingprediction method aim to create atnconfig object from another atnconfig and semanticcontext object in case of the python target the initialization happen without keyword argument since the call init method have default value set for all the parameter the parameter substitution work by index as a consequence the first atnconfig parameter be wrongly interpret as an atnstate and the semanticcontext as an alternative the patch fix this by add the miss keyword |
antlrantlr4 | same input target python3 seem not to terminate in reasonable time whereas it do when target java | Duplicate | test on antlr 4 5 2 4 5 3 the grammar lexer file I provide be generate automatically I attach also the file example gf that parse correctly when use the java target but seem not to terminate or at least I do not leave run enough when use python3 target I really beg your pardon for not give a more coincise input but 1 I do not have much time as I be use antlr4 for hobby 2 I guess you will have more refined analysis tool to hunt the cause of the problem antlrpybug zip |
antlrantlr4 | rule have non ll decision due to recursive rule invocation reachable from alt | Question | hi I be begini at antlr and when I attempt to generate parser I have this error 11 49 26 error 211 vv g 52 3 fatal rule expr have non ll decision due to recursive rule invocation reachable from alt 1 5 resolve by left factoring or use syntactic predicate or use backtrack true option 11 49 26 error 211 vv g 1 8 fatal rule token have non ll decision due to recursive rule invocation reachable from alt 2 9 resolve by left factoring or use syntactic predicate or use backtrack true option my grammar grammar vv stmtblock variabledecl stmt stmt expr ifstmt whilestmt forstmt breakstmt returnstmt printstmt stmtblock ifstmt if expr stmt else stmt whilestmt while expr stmt forstmt for expr expr expr stmt returnstmt return expr breakstmt break printstmt print expr expr expr lvalue lfexpr constant lrexpr this lrexpr call lrexpr expr lrexpr expr lrexpr expr lrexpr readinteger lrexpr readline lrexpr new ident lrexpr newarray expr type lrexpr lfexpr expr lrexpr lrexpr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr expr lrexpr lvalue ident constant lrexpr lflvalue this lrexpr lflvalue call lrexpr lflvalue expr lrexpr lflvalue expr lrexpr lflvalue expr lrexpr lflvalue readinteger lrexpr lflvalue readline lrexpr lflvalue new ident lrexpr lflvalue newarray expr type lrexpr lflvalue lflvalue ident expr lrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue expr lrexpr lflrlvalue ident lrlvalue expr lrlvalue lflrlvalue ident lrlvalue expr lrlvalue how I can solve this error any help please thank |
antlrantlr4 | avoid null entry for ambigous tree list | Invalid | might help in fix |
antlrantlr4 | match empty token at eof | Question | hi I m use lexer mode to match string in my grammar from an example it look like this antlr quote pushmode stringmode mode stringmode string r n r n string quote type quote popmode unterm string self input la 1 in ord r ord n token eof popmode for stuff n I get the token quote string unterm string newline but for stuff I get quote string but I expect unterm string at the end because the predicate would have be true at the end I m assume the lexer stop to look for any new token as soon as it reach the end of the file so be it possible de force the token unterm string to match when eof be reach |
antlrantlr4 | mixfix operator operator extensibility | Question | so after do some fairly quick search perhaps use the wrong term I be wonder if it s indeed possible write grammar in antlr4 that allow user to define custom infix operator something like the technique describe here nad publication danielsson norell mixfix pdf so for instance if a user want to define a set containment operator they could do something like this assume some syntax def b though perhaps they d also have to manually supply a precedence number which be fine figure before I start bang my head against the wall too hard on this I d just ask the devs themselves be there an example of this somewhere use antlr4 that anyone know about |
antlrantlr4 | bug grammar auto build java source even when it s not in a source directory | Invalid | I keep a bunch of g4 file in a doc folder of my project for refer to I don t intend for those to generate source despite set the correct source folder in my project setting the antlr tool still generate java source for any grammar it find regardless of their location in the project |
antlrantlr4 | antlr 4 and spring | Invalid | I m write a web application with a full accounting package to make it more configurable I m do all of the accounting function in a 4gl write in antlr I develop the language in a separate project and make sure it be work before I integrate it into my web project the web project work and the antlr project work however when I integrate the 2 none of my autowired bean work after antlr be call everything work fine before that point be there any issue like that that you know of I can supply code if you wish |
antlrantlr4 | antlr4cs 4 4 3 c throw nullpointerexception when compile xpath grammar xpath g4 | Invalid | development environment detail visual studio 2015 oracle jre 8u73 package antlr4 4 3 0 build antlr4 target 132 5 error ac0031 antlr can not generate org antlr v4 codegen csharp v4 5 2target code as of version 4 3 package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error exception in thread main java lang nullpointerexception package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error at org antlr v4 codegen codegenerator gettemplate codegenerator java 91 package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error at org antlr v4 automata lexeratnfactory lexeratnfactory java 114 package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error at org antlr v4 tool processnoncombinedgrammar tool java 403 package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error at org antlr v4 tool process tool java 376 package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error at org antlr v4 tool processgrammarsoncommandline tool java 343 package antlr4 4 3 0 build antlr4 target 132 5 error ac1000 unknown build error at org antlr v4 csharptool main csharptool java 59 build 0 succeed 1 fail 0 up to date 0 skip |
antlrantlr4 | antlr4 go into infinite loop | Duplicate | try to answer issue bad parsing of ternary expression 1119 get antlr into an endless loop input be 3 between 9 and 10 and 4 between 65 and 76 start parse from expression ie java org antlr v4 gui testrig mssql expression gui trace token code be grammar mssql expression disjuncte search condition disjuncte search condition betweener or betweener betweener predicate betweenness expression and expression betweenness between not between not between not between conjuncte search condition predicate and predicate predicate decdigit and and or or not not between between datum type int semicolon as as ceq decdigit 0 9 sident I output be 3 between 9 and 10 and 4 between 65 and 76 z 0 0 0 3 10 1 0 1 2 8 between 4 1 2 2 10 10 9 10 1 10 3 12 14 and 1 1 12 4 16 17 10 10 1 16 5 19 21 and 1 1 19 6 23 23 4 10 1 23 7 25 31 between 4 1 25 8 33 34 65 10 1 33 9 36 38 and 1 1 36 10 40 41 76 10 1 40 11 44 43 1 2 0 enter expression lt 1 3 enter disjuncted search condition lt 1 3 enter betweener lt 1 3 enter predicate lt 1 3 consume 0 0 0 3 10 1 0 rule predicate exit predicate lt 1 between enter betweenness lt 1 between enter between lt 1 between consume 1 2 8 between 4 1 2 rule between exit between lt 1 9 exit betweenness lt 1 9 enter expression lt 1 9 enter disjuncted search condition lt 1 9 enter betweener lt 1 9 enter predicate lt 1 9 consume 2 10 10 9 10 1 10 rule predicate exit predicate lt 1 and enter betweenness lt 1 and line 1 12 no viable alternative at input and exit betweenness lt 1 and enter expression lt 1 and enter disjuncted search condition lt 1 and enter betweener lt 1 and enter predicate lt 1 and consume 4 16 17 10 10 1 16 rule predicate exit predicate lt 1 and enter betweenness lt 1 and line 1 19 no viable alternative at input and exit betweenness lt 1 and enter expression lt 1 and enter disjuncted search condition lt 1 and enter betweener lt 1 and enter predicate lt 1 and consume 6 23 23 4 10 1 23 rule predicate exit predicate lt 1 between enter betweenness lt 1 between enter between lt 1 between consume 7 25 31 between 4 1 25 rule between exit between lt 1 65 exit betweenness lt 1 65 enter expression lt 1 65 enter disjuncted search condition lt 1 65 enter betweener lt 1 65 enter predicate lt 1 65 consume 8 33 34 65 10 1 33 rule predicate exit predicate lt 1 and enter betweenness lt 1 and line 1 36 no viable alternative at input and exit betweenness lt 1 and enter expression lt 1 and enter disjuncted search condition lt 1 and enter betweener lt 1 and enter predicate lt 1 and consume 10 40 41 76 10 1 40 rule predicate exit predicate lt 1 enter betweenness lt 1 line 2 0 no viable alternative at input exit betweenness lt 1 enter expression lt 1 enter disjuncted search condition lt 1 enter betweener lt 1 enter predicate lt 1 exit predicate lt 1 enter betweenness lt 1 exit betweenness lt 1 enter expression lt 1 enter disjuncted search condition lt 1 enter betweener lt 1 enter predicate lt 1 exit predicate lt 1 enter betweenness lt 1 exit betweenness lt 1 enter expression lt 1 enter disjuncted search condition lt 1 and so on forever window 2008 r2 recent version of antr4 not the very late though how do I get the version can reproduce |
antlrantlr4 | context sensitive parse bug | Invalid | hi I ve come across a bug whilst try try to track down why the parser I m work on be resort to context sensitive parse the bug be reproducible use the simple grammar below with the follow sample input select a x b y in the grammar below the from table source clause rule be not actually use it should ultimately be part of the query specification rule but different output be obtain depend on whether or not this rule be include in the grammar source file compile and run the grammar as be produce the follow output antlr4 qtn g4 javac java grun qtn query specification diagnostic test sql warning testrig move to org antlr v4 gui testrig call automatically line 2 0 reportattemptingfullcontext d 3 qualified table name input a x b y line 1 10 reportcontextsensitivity d 3 qualified table name input a x line 2 0 reportattemptingfullcontext d 3 qualified table name input b y line 2 0 reportcontextsensitivity d 3 qualified table name input b y if the grammar be now modify by remove the follow line from table source clause from qualified table name qualified table name the output now change to the follow rm class antlr4 qtn g4 javac java grun qtn query specification diagnostic test sql warning testrig move to org antlr v4 gui testrig call automatically it would appear that the parser be now able to parse the test file without use context sensitive parse even though the only change be to remove a grammar rule which be never use in the first place since the from table source clause rule be never use in the original grammar its removal should have no material impact on the parser and its output jonathan grammar qtn query specification select select item comma seq select item comma seq qualified column name qualified column name from table source clause from qualified table name qualified table name qualified column name qualified table name column name qualified table name schema name table name schema name identifi table name identifi column name identifi identifi a za z a za z 0 9 white space t r n skip |
antlrantlr4 | bug in generate javascript for recursive rule action | Duplicate | I have a lisp style recursive list construct in my grammar like so javascript we do this the old fashioned way because that s what the compiler want statement list return retval statement retval type stmt list head statement retval tail null statement statement list retval type stmt list head statement retval tail statement list retval I m use action to build up an ast in the form of nest js object however the tail property be always null for the second rule where it should be non null when I look at the generate code I see javascript localctx retval type stmt list head localctx statement retval tail localctx retval the tail property be be set to the unset retval attribute of the local context not the sub context pertain to the recursive statement list rule and that s why it s always null the code should be generate as javascript localctx retval type stmt list head localctx statement retval tail localctx statement list retval when I make the change by hand to the generate parser it work like a charm |
antlrantlr4 | c backtrack win t work | Invalid | grammar test option backtrack true memoize true language csharp3 prog code code bt console writeline bt other console writeline other bt abc other this grammar output input abc token abc select input acd 3 token other select input abd throw early exit exception should be 3 other also this test also fail on antlrwork |
antlrantlr4 | rfc incremental parse | Question | I be do some research on how to use antlr parser incrementally I come across some old discussion from 2009 this offer various solution outside antlr core itself since a lot of time have pass and new version of antlr have be create I want to check if there be a recommendation on how to implement antlr parser for incremental parse |
antlrantlr4 | python3 generate invalid syntax | Invalid | use the version commit 01e6923dbd1c3cc37925459b491d9ad93eeb4ca6 date tue dec 8 11 39 09 2015 0800 use the input and the command java jar antlr4 tool target antlr4 4 5 2 snapshot jar dlanguage python3 g4 I get invalid syntax generate python3 4 antlrv4lexer py file antlrv4lexer py line 979 return character isjavaidentifierpart character tocodepoint char input la 2 char input la 1 syntaxerror invalid syntax look very much like c or java typecast |
antlrantlr4 | white space in antlr error message | Invalid | I have a lexer parser that work great and be set to ignore white space consequently I think no viable input at error message report a string of text with no white space separate the text rendering of the token find so far this be a hard to read error message and unfriendly to non antlr aware user what about separate the token in this and any similar message with space one can of course make all custom error message but for those message that be not or be not yet make custom this fix would help or be there a well way to accomplish it |
antlrantlr4 | version information omit from manifest mf in antlr 4 5 1 complete jar | Bug | several property have be omit from meta inf manifest mf in antlr 4 5 1 complete jar I notice this when I add 4 5 1 to the antlr plugin for eclipse it show null in the version column screenshot attach here s what I m see in the file manifest version 1 0 archiver version plexus archiver build by parrt create by apache maven 3 3 3 build jdk 1 8 0 60 ea main class org antlr v4 tool and here s what s in the manifest mf for 4 5 manifest version 1 0 implementation vendor antlr implementation title antlr 4 tool implementation version 4 5 implementation vendor i d org antlr build jdk 1 6 build by parrt create by main class org antlr v4 tool could we get the miss property add to the 4 5 1 jar packaging thank larry image |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.