forked from jasder/antlr
Replace init with init_ in DelegatorRuleOverridesLookaheadInDelegate.
init is the name of the instance initializer function in Swift, so generating a grammar with that name causes problems, since it is generated into function names on the parser. I thought that renaming this would be a problem for other targets, but it doesn't look like it, and actually the convention of using type_ rather than type is already in use in this file. Match this by adopting init_ as the name, and regenerate the tests to match. This was initially handled in https://github.com/janyou/ANTLR-Swift-Target (using the name initIt instead of init).
This commit is contained in:
parent
ee469ae6d8
commit
cf1487feb4
|
@ -33,6 +33,6 @@ slaveGrammar(grammarName) ::= <<
|
|||
parser grammar S;
|
||||
type_ : 'int' ;
|
||||
decl : type_ ID ';'
|
||||
| type_ ID init ';' {<write("\"JavaDecl: \" + $text")>};
|
||||
init : '=' INT;
|
||||
| type_ ID init_ ';' {<write("\"JavaDecl: \" + $text")>};
|
||||
init_ : '=' INT;
|
||||
>>
|
||||
|
|
|
@ -332,8 +332,8 @@ public class TestCompositeParsers extends BaseTest {
|
|||
"parser grammar S;\n" +
|
||||
"type_ : 'int' ;\n" +
|
||||
"decl : type_ ID ';'\n" +
|
||||
" | type_ ID init ';' {print(\"JavaDecl: \" + $text, terminator: \"\")};\n" +
|
||||
"init : '=' INT;";
|
||||
" | type_ ID init_ ';' {print(\"JavaDecl: \" + $text, terminator: \"\")};\n" +
|
||||
"init_ : '=' INT;";
|
||||
writeFile(tmpdir, "S.g4", slave_S);
|
||||
|
||||
StringBuilder grammarBuilder = new StringBuilder(121);
|
||||
|
|
Loading…
Reference in New Issue