Terence Parr
2b3508d57e
Merge pull request #1662 from bhamiltoncx/no-more-char-casts
...
Get rid of all (char) casts
2017-02-17 13:21:16 -08:00
Ivan Kochurkin
fab6172749
Added "action" to badWords set for Go runtime.
...
Some spaced replaced with tabs.
2017-02-17 23:31:51 +03:00
Ben Hamilton
88ecb3d9fa
Get rid of all (char) casts
2017-02-16 09:55:08 -08:00
Ben Hamilton
c35bbabc16
PR #1658 : Also write stderr to file
2017-02-16 09:44:40 -08:00
Terence Parr
6c878b0709
Merge pull request #1653 from bhamiltoncx/codegen-unicode-escapes
...
Emit language-specific Unicode escapes in codegen
2017-02-15 16:48:50 -08:00
Terence Parr
287f17b796
Merge pull request #1652 from bhamiltoncx/csharp-lexer-parser-output-file
...
C# support for lexer and parser output to a file
2017-02-13 15:10:54 -08:00
Terence Parr
9b7e2a81ce
Merge pull request #1651 from bhamiltoncx/python-lexer-parser-output-file
...
Python 2 and Python 3 support for lexer and parser output to a file
2017-02-13 15:10:19 -08:00
Ben Hamilton
c7e7550a12
Fix CSharpTarget.java
2017-02-13 08:56:57 -08:00
Ben Hamilton
0049d6d9ae
Emit language-specific Unicode escapes when generating code containing non-ASCII Unicode values
2017-02-10 14:31:56 -08:00
Terence Parr
ae5250685d
Merge pull request #1637 from bhamiltoncx/char-streams
...
Make BaseJavaTest and TestRig work with Unicode values > U+FFFF
2017-02-10 14:11:34 -08:00
Ben Hamilton
6611c1ae27
C# runtime and test harness support for writing test output to file
2017-02-10 13:37:44 -08:00
Ben Hamilton
2c447a2b75
Python 2 and Python 3 support for lexer and parser output to a file instead of stdout
2017-02-10 13:11:24 -08:00
Ivan Kochurkin
23f59ad99d
Removed trailing comma in channelNames for Python 2 & 3, JavaScript.
2017-01-31 00:34:10 +03:00
Ivan Kochurkin
7b8ba3550b
channelNames support in LexerInterpreter (C#, C++, Java, Swift).
2017-01-31 00:34:10 +03:00
Ivan Kochurkin
ccb325db42
Removed trailing comma in channel names.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
9998db82ce
Added channel constants to Go runtime.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
f9fa84213c
Swift: mode constants written to file as tokens and channels.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
956dc0547f
C++: mode constants written to file as tokens and channels.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
1fe1216e26
C#: mode constants written to file as tokens and channels.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
00d0ba129b
Mode constants written to file as tokens and channels.
...
I mean:
```Java
public static final int M1=1, M2=2;
```
instead of
```Java
public static final int M1=1;
public static final int M2=2;
```
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
e9e83a69e7
Added channel constants to Python 2 & 3 runtimes.
...
Improved indentation.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
def7e6afc8
Added channel constants to JavaScript runtime.
...
Improved indentation.
2017-01-31 00:32:21 +03:00
Ivan Kochurkin
c3d96eb5d7
Added channelNames to all runtimes.
2017-01-31 00:32:21 +03:00
Ben Hamilton
0f52b7c0d9
CharStreams
2017-01-30 10:09:56 -08:00
Terence Parr
0901851719
Merge pull request #1585 from KvanTTT/left-recursive-rule-labels
...
The final fix (hopefully) for alternative labels check in left recursive rules
2017-01-29 13:34:32 -08:00
Gary Miller
7cbef5617c
removed lower case formatting on types. Case has meaning in Go, needs preserving.
2017-01-11 22:33:35 +11:00
Gary Miller
810000c23e
removed superClass import
2017-01-11 22:21:29 +11:00
Ivan Kochurkin
d71c2157ce
Fixed @sharwell note about comment.
2017-01-08 15:08:48 +03:00
Ivan Kochurkin
4a5717162e
Fixed indents for else statements.
...
Fixed correct token in checkForTypeMismatch.
2017-01-07 18:37:17 +03:00
Ivan Kochurkin
a558334a01
Code cleared, added comments.
2017-01-07 18:26:22 +03:00
Ivan Kochurkin
385e96784d
Initial fix for labels in left recursive rules: https://github.com/antlr/antlr4/pull/1570 & https://github.com/antlr/antlr4/issues/1543
2017-01-07 18:16:22 +03:00
Sam Harwell
587ea3646c
Don't use list labels for elements that appear twice in a block set
2017-01-06 00:21:42 -06:00
Sam Harwell
204c281772
Fix optional element analysis
...
* Properly handle elements that are optional in some alts but not others
* Properly handle block sets (a group of terminals producing a SetTransition)
* Properly handle OPTIONAL subrule
2017-01-06 00:19:43 -06:00
Sam Harwell
9009a1b989
Simplify logic leaving a subrule in ElementFrequenciesVisitor
2017-01-04 11:46:47 -06:00
Sam Harwell
eb53e70e39
Implement support for optional getters
...
This analysis is required for proper code generation in the TypeScript target
when strict null checks are enabled. It also applies to targets intending to
differentiate optional values from required values.
2017-01-04 09:43:20 -06:00
Sam Harwell
6b007b445c
Disable label checks for left recursive rules
...
See #1543
2017-01-02 14:14:06 -06:00
Mike Lischke
c874ab68fb
Merge branch 'master' into optimizations
2017-01-01 17:40:48 +01:00
Mike Lischke
a60fcfed0f
Removed the need of a shadow s0 copy in the DFA class.
2017-01-01 17:39:44 +01:00
Terence Parr
aa909ddcb1
Merge pull request #1563 from parrt/bump-to-4.6.1
...
bump version to 4.6.1 in all files.
2016-12-28 14:09:33 -08:00
parrt
2629433830
bump version to 4.6.1 in all files.
2016-12-28 12:03:43 -08:00
parrt
36ee17449f
Fixes #1556 .
...
```
beast:/tmp $ a4.6 T.g4
org/antlr/v4/parse/GrammarTreeVisitor.g: node from line 2:7 no viable alternative at input '..'
org/antlr/v4/parse/GrammarTreeVisitor.g: node from line 2:7 no viable alternative at input '..'
org/antlr/v4/parse/GrammarTreeVisitor.g: node from line 2:7 no viable alternative at input '..'
org/antlr/v4/parse/GrammarTreeVisitor.g: node from line 2:7 no viable alternative at input '..'
org/antlr/v4/parse/GrammarTreeVisitor.g: node from line 2:7 no viable alternative at input '..'
context [/report INTERNAL_ERROR] 1:17 attribute arg isn't defined
error(20): internal error:
beast:/tmp $ a4.6.1 T.g4
error(181): T.g4:2:4: token ranges not allowed in parser: 'A'..'Z'
```
2016-12-28 11:47:48 -08:00
Sam Harwell
7a83cd4910
Fix code generation for LL1OptionalBlock bypass alternative
...
See #1545
2016-12-23 16:12:43 -06:00
parrt
3ce00ec933
fix some typos Sam noticed.
2016-12-22 09:43:18 -08:00
Mike Lischke
367f09dcbe
Removed command line option for exportMacro.
...
This is now handled via a grammar option.
2016-12-21 09:11:31 +01:00
Mike Lischke
a9dc3ebd86
Merge branch 'master_upstream'
2016-12-19 16:47:39 +01:00
parrt
23313ee44e
[maven-release-plugin] prepare for next development iteration
2016-12-15 14:25:41 -08:00
parrt
aacd2a2c95
[maven-release-plugin] prepare release 4.6
2016-12-15 14:25:36 -08:00
parrt
31726311a8
add exportMacro to list of valid grammar options. verified it works in grammar and -D on command line.
2016-12-15 13:25:02 -08:00
Mike Lischke
d1b429d94c
Added a new setting required by the C++ runtime.
...
In order to export generated classes in DLLs we need a way to specify the __declspec setting. This is is usually done via a macro that takes the import or export value. The new parameter (`-export-macro`) allows to specify this, which increases the flexibility of the generated classes.
The C++ target documentation has been extended to describe build specific things, includig this new parameter.
2016-12-15 13:11:10 -08:00
parrt
160825a86f
minor reformatting.
2016-12-15 11:41:56 -08:00
parrt
e0460f103b
simplify; reduce indentation.
2016-12-15 11:32:48 -08:00
parrt
b503838a59
simplify
2016-12-15 11:22:42 -08:00
parrt
642d06ebb2
fix typo
2016-12-15 11:15:56 -08:00
Ivan Kochurkin
5d3b99b2ee
Fixed error message for EMPTY_STRINGS_AND_SETS_NOT_ALLOWED.
2016-12-15 11:08:09 -08:00
Ivan Kochurkin
75d5db5941
Implemented CHARACTERS_COLLISION_IN_SET handling.
...
Implemented EMPTY_STRINGS_AND_SETS_NOT_ALLOWED for empty sets.
Improved INVALID_ESCAPE_SEQUENCE, fixes #1077
2016-12-15 11:08:09 -08:00
Ivan Kochurkin
37148ff7fa
Added CHARACTERS_COLLISION_IN_SET warning.
...
EMPTY_STRINGS_NOT_ALLOWED rename to EMPTY_STRINGS_AND_SETS_NOT_ALLOWED.
2016-12-15 11:08:09 -08:00
Mike Lischke
428ff28f35
Added a new setting required by the C++ runtime.
...
In order to export generated classes in DLLs we need a way to specify the __declspec setting. This is is usually done via a macro that takes the import or export value. The new parameter (`-export-macro`) allows to specify this, which increases the flexibility of the generated classes.
The C++ target documentation has been extended to describe build specific things, includig this new parameter.
2016-12-15 16:44:26 +01:00
parrt
f38ccba94a
Fixes #1514
2016-12-14 12:26:32 -08:00
parrt
a3aa610e3d
get recognizer name properly. Fixes #958
2016-12-13 11:05:39 -08:00
Terence Parr
ec5f2ecf31
Merge pull request #1498 from parrt/fix-1299
...
Fixes #1299 . matching a set didn't properly notify error strategy of a successful match
2016-12-13 08:30:49 -08:00
parrt
a69299c507
set javadoc to deploy phase.
2016-12-13 08:17:13 -08:00
parrt
068a13e0f8
Update all other targets
2016-12-12 18:09:55 -08:00
parrt
b11ff9636a
Fixes #1299 . matching a set didn't properly notify error strategy of a successful match.
2016-12-12 17:54:53 -08:00
parrt
2739a0c9ef
Fixes #1492 . only create javadoc if we use `mvn -DskipTests javadoc:jar install`
2016-12-12 17:33:39 -08:00
Eric Vergnaud
39de8896f8
Merge branch 'master' into realign-csharp-runtime
2016-12-12 21:54:26 +08:00
Terence Parr
08a8e30864
Merge pull request #1470 from gaulouis/issue-1457
...
Issue 1457
2016-12-11 15:14:36 -08:00
parrt
42086eff6e
Fix #980
2016-12-11 14:56:11 -08:00
Eric Vergnaud
0170c9a064
Good progress with parser
2016-12-12 02:00:09 +08:00
Eric Vergnaud
19d70cd777
TestLexerExec tests pass
2016-12-12 00:52:09 +08:00
parrt
0dae6359ec
Fixes #1007 .
2016-12-10 18:29:09 -08:00
parrt
52cecbe9e1
generates tool javadoc jar now
2016-12-10 18:21:10 -08:00
parrt
98900144b2
attempting to get src/javadoc back.
2016-12-10 18:09:37 -08:00
parrt
731603b489
maven shade and bundle don't work together so i dropped bundle for main complete jar.
2016-12-10 17:31:03 -08:00
parrt
c0e7c49a9e
update jar version, add implementation manifest entries. Fixes #1036
2016-12-10 16:43:10 -08:00
parrt
9b758cb668
update versions
2016-12-10 16:07:35 -08:00
parrt
0de8a9c414
simplify tool pom
2016-12-10 15:32:39 -08:00
parrt
e65154c161
Fix #1073 . Better token output.
2016-12-10 14:34:50 -08:00
parrt
0eb27279de
fix LL1 analyzer
2016-12-09 18:07:47 -08:00
gaulouis
258b1a4a38
Redo dynamic cast
2016-12-09 21:37:52 +01:00
gaulouis
e9859bcd2f
Fix unnecessary cast
2016-12-09 18:43:07 +01:00
gaulouis
ea53dac7b7
Fix antlr4:: namespace pollution in Lexer/Parser headers
2016-12-09 18:35:55 +01:00
Terence Parr
2dddd007e4
Merge pull request #1462 from pboyer/lafix
...
Fix for #1459
2016-12-08 12:19:14 -08:00
Terence Parr
11117e02d4
Merge pull request #1458 from KvanTTT/mixed_type_labels_1409
...
Check labels for tokens with different types
2016-12-08 11:47:09 -08:00
parrt
2c99f187a0
make it read "Copyright (c) 2012-2016 The ANTLR Project"
2016-12-08 11:43:06 -08:00
parrt
1b1a9862c4
contributors->authors
2016-12-08 11:43:06 -08:00
parrt
61e8eba4fc
fix typo
2016-12-08 11:43:06 -08:00
parrt
891915de84
Update copyright on java, xml files. Make BSD license conform to standard.
2016-12-08 11:40:30 -08:00
Peter Boyer
0cb32c0620
Fix for repeat declaration of la_
2016-12-07 21:03:03 -05:00
Ivan Kochurkin
bdc1911e6e
Removed not used LabelType.
2016-12-07 22:40:27 +03:00
Ivan Kochurkin
d5dda9f998
Added check for labels with different token types.
...
Spaces -> Tabs.
2016-12-07 22:39:27 +03:00
Terence Parr
abed9e733a
Merge pull request #1449 from KvanTTT/duplicated_and_nonsensical_commands_1388
...
Duplicated and incompatible commands
2016-12-05 13:40:10 -08:00
Ivan Kochurkin
e4c765aa27
Added comment.
2016-12-04 15:11:25 +03:00
Ivan Kochurkin
bf3bff16e4
Misprints fixed, code style improved (removed unnecessary else).
2016-12-04 15:06:07 +03:00
Ivan Kochurkin
cb16e369fe
Misprint in comment.
2016-12-04 04:05:55 +03:00
Ivan Kochurkin
0e1b5d9d7a
Merge branch 'command_wrong_id_1411' into duplicated_and_nonsensical_commands_1388
...
# Conflicts:
# tool/src/org/antlr/v4/tool/ErrorType.java
2016-12-04 03:57:11 +03:00
Terence Parr
f11a380609
Merge pull request #1417 from KvanTTT/command_wrong_id_1411
...
ANTLR generates a wrong lexer code if type, channel or mode commands use inproper identifier
2016-12-03 16:55:23 -08:00
Ivan Kochurkin
4e2f50aef8
Added new error types for not recognized token, mode or channel name.
2016-12-04 03:47:28 +03:00
Ivan Kochurkin
b8585b7eb5
Fixed some missed cases for checkCommands.
2016-12-04 02:32:39 +03:00
Terence Parr
8ead51d8ff
Merge pull request #1423 from wxio/master
...
Fix for redeclared error is generated Go code.
2016-12-01 10:51:40 -08:00
Peter Boyer
f00e346ccd
Add additional _alt decl
2016-11-30 11:18:26 -05:00
Peter Boyer
ced8fba5bc
Update Go.stg
2016-11-29 23:50:39 -05:00
Peter Boyer
39c77ca20f
Potential fix for antlr/antlr4 #1397
2016-11-29 23:45:29 -05:00
Denis Blank
c8279a1d89
Fix a dangerous c-cast in the cpp codegen
2016-11-29 17:14:02 +01:00
Ivan Kochurkin
9aab338021
Reverted old error types and numbers.
2016-11-29 19:12:43 +03:00
Ivan Kochurkin
44aab113f3
Added method checkCommands.
...
commands check micro optimization and code clearing.
2016-11-29 18:48:03 +03:00
Ivan Kochurkin
f76ca22763
MODE_CONFLICTS_WITH_TOKEN error restored.
2016-11-29 18:13:57 +03:00
Ivan Kochurkin
8fe4def4ed
Warnings for incompatible commands, added unit-test, fixes #1388 .
...
Improved test for duplicated commands (added pushMode, popMode).
2016-11-29 16:03:33 +03:00
Ivan Kochurkin
ed7f6f70da
pushMode and popMode commands are not duplicated.
2016-11-29 16:00:41 +03:00
Gary Miller
763669ffc7
Fix for redeclared error is generated Go code. Create block so _x and _m var are created in a local scope.
2016-11-29 12:35:48 +11:00
Ivan Kochurkin
bd1111ffa3
Fixed issue with duplicated commands in lexer rule.
2016-11-28 19:48:35 +03:00
Ivan Kochurkin
a1def96500
getConstantValue replaced with getModeConstantValue, getTokenConstantValue and getChannelConstantValue methods.
...
ErrorType simplified, tests fixed.
Fixes #1411 , added unit-test.
2016-11-28 14:41:04 +03:00
parrt
3506dcef1d
add @Override to hush warnings. Manually did some of https://github.com/antlr/antlr4/pull/1066
2016-11-25 12:52:44 -08:00
Sam Harwell
f196971565
Fix failure to identify prefix rules that also recurse
...
Fixes #1402
2016-11-24 14:38:34 -06:00
parrt
6c2d4e6225
Fixes #1211
2016-11-22 15:04:28 -08:00
parrt
dc2c9b039e
Fixes #1188
2016-11-22 14:21:07 -08:00
parrt
4e6e7edf0d
Fixes #1317
2016-11-21 13:45:05 -08:00
Terence Parr
8ed1105290
Merge pull request #1353 from marcohu/fix_1233
...
Grammar dependency management for Maven plugin
2016-11-21 11:21:58 -08:00
parrt
d580f2184f
Use JFrame instead of JDialog to get "expand window" buttons
2016-11-21 10:42:52 -08:00
Marco Hunsicker
cfc538bfdc
Merge branch 'master' of https://github.com/antlr/antlr4 into fix_1233 to solve
...
Conflicts:
contributors.txt
2016-11-21 19:23:48 +01:00
parrt
66be087c38
merge old and new travis; improve so it runs C++ on osx; update BaseSwiftTest so it mirrors other targets; remove unneeded dep in pom to some json stuff
2016-11-20 19:50:54 -08:00
Marco Hunsicker
a077d3d072
Merge branch 'master' of https://github.com/antlr/antlr4 into fix_1233
2016-11-20 12:49:39 +01:00
hanjoes
e0b326677b
Migrating the current Swift tests to the new testing framework.
2016-11-19 18:30:48 -08:00
janyou
cddb8a6ff2
Update Swift.stg
...
add namedActions
2016-11-19 18:30:48 -08:00
janyou
abf2a1883c
Update SwiftTarget.java
...
"4.5.1"->"4.5.3"
2016-11-19 18:30:48 -08:00
janyou
fc3fa24464
Update Swift.stg
2016-11-19 18:30:48 -08:00
janyou
61248c8a4d
Update Swift.stg
2016-11-19 18:30:48 -08:00
Ewan Mellor
6d6327aa9d
Move the Token declarations into an enum.
...
This avoids the naming conflict in the tests between the use of ATN as a
token name and as a type name.
2016-11-19 18:30:48 -08:00
Ewan Mellor
869bcfe429
Mark matchWildcard call with a try, since it can throw.
2016-11-19 18:30:48 -08:00
Ewan Mellor
6d5d1f1c23
Add build system changes needed for Swift backend.
2016-11-19 18:30:48 -08:00
Ewan Mellor
c989064e32
Added (part of) a Swift backend.
...
This comes from https://github.com/janyou/ANTLR-Swift-Target and is
marked Copyright (c) 2016 janyou on top of the BSD license and Copyrights
for Terence Parr and Sam Harwell derived from the original ANTLR source.
2016-11-19 18:30:48 -08:00
Terence Parr
10ce5d2625
Merge pull request #1311 from sebkur/allow_path_in_token_vocab
...
Allow paths as tokenVocab option
2016-11-19 15:30:19 -08:00
parrt
f5d3e4cfe6
Improve robustness and correctness of two functions used by intellij antlr4 plugin to show ambig and lookahead parse trees.
2016-11-19 13:06:49 -08:00
parrt
d0620a65f5
Merge branch 'issue#1295' of git://github.com/harriman/antlr4-updates into harriman-issue#1295
2016-11-19 12:05:32 -08:00
parrt
5153154658
Merge branch 'fix_typos' of git://github.com/sebkur/antlr4 into sebkur-fix_typos
2016-11-19 11:52:17 -08:00
Marco Hunsicker
81efb0e366
Merge branch 'master' of https://github.com/antlr/antlr4 into fix_1233
2016-11-18 17:53:54 +01:00
Marco Hunsicker
7d83a3aa9c
More cleanup; use save Collection comparison
2016-11-17 23:29:27 +01:00
parrt
5adf79121f
revert Go "fix"
2016-11-17 11:16:22 -08:00
Terence Parr
cf5a79a5b2
Merge pull request #1362 from sridharxp/stgwotempvar
...
Stgwotempvar
2016-11-17 19:26:34 +01:00
Kurt Harriman
ab8d17472f
ANTLR4 generated incorrect code to access return value of recursive rule
...
Incorrect code was generated for $e.v in a rule like this one:
e returns [int v] ::=
INT {$v = $INT.int;}
| '(' e ')' {$v = $e.v;}
;
After parsing "(99)" the result would have v == 0 instead of 99.
2016-11-16 22:38:11 -08:00
parrt
4f3c7738f3
ignore :: in C++ arg declarations; add test.
2016-11-16 12:34:14 -08:00
parrt
5aae2edb24
support x:T notation in rule arguments, update documentation, improve [...] scope parsing testing
2016-11-16 11:54:23 -08:00
hanjoes
03fa75efba
differentiate prefix/postfix type decl.
2016-11-16 11:44:39 -08:00
sridharxp
6e09f08348
InvokeRule without Fix without Temporary variable
2016-11-16 13:14:38 +05:30
parrt
08e9776a4a
shift template-based runtime test to legacy, new mechanism uses annotation to get multi-line strings into java. all tests pass minus about 15 in C#
2016-11-15 11:08:19 -08:00
Marco Hunsicker
be585f6a8f
Make graph accessible to the outside
2016-11-14 00:29:51 +01:00
parrt
da342af01e
added sync() per other targets to LL(1) decisions
2016-11-07 14:48:20 -08:00
parrt
f8bec27d6d
bring Go target templates up to same args as others.
2016-11-07 11:07:46 -08:00
parrt
3d0678508b
reuse code to builld named actions. all file model objects have it now.
2016-11-07 11:07:23 -08:00
parrt
51d38110be
trying a refactoring to test if i can push back
2016-11-07 10:55:48 -08:00
Mike Lischke
1c3a5879e6
Set required runtime version to 4.6.
2016-11-07 11:22:46 +01:00
Mike Lischke
92b032820e
Merge branch 'master_upstream'
2016-11-07 11:19:12 +01:00
Mike Lischke
3b3fe3da57
Merge branch 'master_upstream'
...
Had to resolve a number of conflicts + added code required for the C++ target to generate header files, after the recent changes in the main repo.
2016-11-07 11:16:02 +01:00
parrt
ffaedd209d
Set version in code to 4.6.
2016-11-06 11:21:06 -08:00
parrt
e5ec462e22
Fixes #1337 . Add's sync() call back to LL(1) decisions; all targets updated (causing failed test in Go). Altered test for new output of errors. regen'd tests.
2016-11-06 09:45:40 -08:00
parrt
95c850e5f8
set version in prep for 4.6
2016-11-05 16:48:36 -07:00
Peter Boyer
fc35818c52
Update import statements after merge
2016-11-05 16:36:53 -04:00
parrt
0799e838bb
weird. missed a few files. these are to simplify get filename functionality.
2016-11-05 09:32:04 -07:00
parrt
abdb0b6a46
Merge branch 'model-updates-for-new-targets' of github.com:parrt/antlr4 into reduce-model-changes
2016-11-05 09:29:25 -07:00
parrt
2c98b5d325
incorporate in a single commit all changes needed to support generating header files. many fewer diffs with C++ target codegen now.
2016-11-05 09:25:51 -07:00
parrt
6d022379bc
Pull in parrt's branch 'model-updates-for-new-targets' which appears to have freshened some non Go stuff as well. Simplify Go filename construction.
2016-11-05 08:48:37 -07:00
parrt
40e19e5d37
refactor so getRecognizerFileName() etc... delegate to Target; default is same behavior. adds "is header" arg as well in prep for C++
2016-11-05 08:08:08 -07:00
parrt
75794a588b
track different types of StructDecl elements so Go can do setters/getters.
2016-11-05 07:35:57 -07:00
parrt
c0cedc424b
track different types of StructDecl elements so Go can do setters/getters.
2016-11-05 07:35:39 -07:00
Mike Lischke
e71e95080a
Merge branch 'master_upstream'
...
Also updated the list of ignored tests in the Cpp.test.stg file (lke it is done for the other targets).
2016-11-05 15:07:59 +01:00
parrt
8b8094c044
appears to be an ST bug that doesn't see arrays of len 0 as missing; convert array to List.
2016-11-05 06:55:09 -07:00
parrt
e0521400cb
rm need for isRuleContext in templates; refer to underlying grammar object.
2016-11-05 06:28:58 -07:00
parrt
85f2a87840
rm recognizerName field where possible
2016-11-04 16:07:45 -07:00
parrt
95dbf7b44b
look for go in path during tests
2016-11-04 16:06:41 -07:00
Sebastian Kürten
2f628a1106
Fix another typo
2016-11-01 11:56:46 +01:00
Sebastian Kürten
8b16ff180a
Fix a few typos in Javadoc
2016-11-01 11:46:04 +01:00
kai stammerjohann
f3c55be33c
fix RulePropertyRef_stopHeaderHeader typo
2016-11-01 09:17:46 +01:00
Mike Lischke
f794820aaf
Reworked mutex handling + updated C++ template for a var init
...
- Mutexes have been consolidated. Instead of one per DFA (which can easily get to hundreds of them) we only have one mutex in the Recognizer class and all other parties use this for serialization. It's only about protected the DFA anyway, which is stored in a recognizer (lexer/parser).
- ATNState::getStateType() returns a size_t value now (actually an enum).
- Replaced checks via RTTI for transitions by the (serialization) type of the transition, for simplicity.
- Added some missing initialization for fields in certain ATN state classes.
- Fixed mem leak in DFA by shadowing the s0 field. That way still have a ref to the self created instance, even is s0 was replaced later.
- Added variable init in code generation for a rule context declaration (e.g. for labels).
2016-10-29 14:46:38 +02:00
Sebastian Kürten
961f087d7a
Allow paths as tokenVocab option
2016-10-25 10:31:04 +02:00
Peter Boyer
2444386091
Remove JavaScript PORT_DEBUG, re-enable runtime tests for other language targets ( #69 )
...
* Re-enable runtime tests for other language targets
* Fix typo in js code
* Remove PORT_DEBUG statements
* Fix missing
* Fix testAltNum
2016-10-13 17:06:22 -04:00
parrt
4312b37828
pull test changes in
2016-10-13 10:58:19 -07:00
Peter Boyer
42347c078b
Fix merge failure
2016-10-12 09:53:43 -04:00
Peter Boyer
60662c4b70
Fix remaining tests ( #64 )
...
* Fix pred context typo
* Adjust array lengths
* PositionAdjustLexer test fix first steps
* allow virtual method calls from Lexer
* Hopefully fix issues with dup namedActions
* Make parser members
* Fix testParserProperty
* Fix LeftRecursion test failures
2016-10-12 09:49:42 -04:00
Mike Lischke
a4e343806f
Some small optimizations.
...
- No copy of a DFA state during ATN deserialization.
- Fixed memory leak of locally created s0 state in DFAState.
2016-10-12 11:06:51 +02:00
Mike Lischke
4897bd8571
Simplified memory management for volatile parsing part.
...
There are 2 parts in an ANTLR genrated parser where memory is allocated: the actual parsing (with or w/o creating a parse tree) and the prediction part (via DFA/ATN etc.). The first part is highly volatile as it recreates parse tree instances (the class) on each parser run. In fact also lexer tokens belong to that part, but are already managed via unique pointers. This first part works without any smart pointer now. Instead there is a simple tracker class which holds all created references and frees them when the parser is reset or destroyed. This is a bit less optimal if the parser is set to create no parse tree, as created rule context objects are not freed immediately (like with smart pointers), but during reset. On the other hand this change gives (depending on the input) a nice speed up (0%-100%, after the warm up phase). Additionally memory consumption drops by a good amount.
Everything in the simulartors (and interpreters) remains unchanged. This is the shared prediction part.
2016-10-11 13:49:02 +02:00
Christian Gudrian
cb590334bb
the visit methods now return a value
2016-10-06 22:52:19 +02:00
Christian Gudrian
eb292adb18
implemented templates for the JavaScript visitors
2016-10-06 22:52:19 +02:00
Peter Boyer
9b76bc6a71
Update Go.stg
2016-10-05 12:04:01 -04:00
Mike Lischke
a7b9499230
Code generation + Travis CI fixes.
...
- Had to adjust a comparison <= 0 to the new unsigned EOF.
- For testing: extended the runtime tests to all C++ tests.
- Install uuid-dev in Travis CI in order to be able to build the C++ runtime.
2016-10-03 11:25:02 +02:00
Mike Lischke
8280beb564
Refactoring of further int values, mostly converting them to size_t.
...
- Switched most symbolic signed constants to unsigned variants. Redefined EOF in particular to become (size)-1, to avoid having to use signed token type values.
- Introduced INVALID_INDEX for all previous -1 values to indicate e.g. not found indexes etc.
- Added 2 helpers to convert between symbolic and numeric form (mostly for intervals and toString()).
- Removed many no longer needed type casts to size_t.
- Updated templates for these changes.
- Limited runtime tests to C++ tests only, to see how Travis CI copes with that.
2016-10-02 16:51:57 +02:00
Mike Lischke
4394cd20b0
Merge branch 'master_upstream'
2016-09-29 16:50:57 +02:00
Terence Parr
e9aa00e05b
Merge pull request #1172 from renatahodovan/default-pass
...
Add missing default pass statements to Python targets.
2016-09-25 11:24:48 -07:00
Christian Gudrian
46df58d5d7
The JavaScript ParseTreeVisitor now implements a depth-first traversal by default.
2016-09-22 08:28:11 +02:00
Mike Lischke
b0fc8ea0da
Added semicolon generation after some of the header decls.
...
Closes issue #40 .
2016-09-06 09:51:31 +02:00
Mike Lischke
6f62821573
More optimizations of the runtime.
...
- Lesser use of shared_ptr, e.g. in listeners and some loops.
- Removed useless access methods for children in ParseRuleContext. The child list is public. Fixed initialization for start and stop nodes.
- Simplified parent + child organization in Tree and all derived classes. Instead of using overridable functions in various descendants we have now central parent + child fields in the base tree class (where they belong actually, considering this is about forming a tree). Users have to cast to the appropriate classes if necessary.
- Removed obsolete getChildren() function in Trees helper. We can just return the child vector.
- Changed edges member to an unordered_map, as this is a sparse container. This speeds up certain grammars by 1000% (e.g. highly recursive expression rules) and avoids wasting a lot of memory. This change also simplifies handling significantly.
2016-08-22 12:12:22 +02:00
Mike Lischke
ee2510e654
Output formatting in DefaultErrorStrategy and init of generated member vars.
...
- Had to escape tabs + linebreaks in DefaultErrorStrategy when generating a text representation. Also removed a few explicit string instance creations on the way.
- Member vars in parser context classes that take (optional) Token references must be initialized.
- Fixed a warning that copyFrom() would hide a virtual function in a ParserRuleContext.
- Another attempt to limit genrating double semicolons.
2016-08-10 08:55:17 +02:00
Mike Lischke
8335d32b2d
Various smaller changes to fix compilation and other problems.
...
- Added new rule to test grammar to get code generation for wildcard capture.
- Updated the Cpp.stg template file for that.
- Made the Unicode hack (auto extend 0xFFFF to 0x10FFFF) dependent on a parameter, so we only use this hack when deserializing an ATN. This avoids trouble with intervals used in other contexts (like string offsets).
- Added a few operator != overloads, to fix compilation after recent changes.
- Simplified operands comparison in SemanticContext (uses the Arrays class now). Some cleanup in that class too.
- The abstract parse tree visitor now uses const& for Any references, to avoid reallocating new instances over and over again.
- The lexer counts syntax errors the same way as the parser does. So we can directly determine if there was any error by simply examining that (which avoids having to use a temporary listener).
2016-08-04 09:28:13 +02:00
Mike Lischke
8a5f6815fe
Rework of the visitor implementation
...
The translation from Java generics to templates in C++ lead to the need of virtual template functions, which is not supported by C++. Instead we use now the Any class for results of visits and no longer need templates for that part.
2016-07-30 20:03:27 +02:00
Will Faught
7f42bc602b
Add interface build checks for tree types and generated base listeners
2016-07-18 12:19:31 -07:00
Nathan Burles
9fa56a4cd9
Added lexer channels enum to match Java target
2016-07-07 14:04:01 +01:00
Will Faught
a05dea54ec
Fix test case build errors
2016-07-06 09:02:42 -07:00
Mike Lischke
c462e03126
Merge branch 'master_upstream'
2016-06-26 11:12:23 +02:00
Mike Lischke
2352ff03e1
getSerializedATN() wasn't properly overwritten.
2016-06-26 11:10:31 +02:00
Eric Vergnaud
15430d4bf9
remove unwanted semicolon in generated Python code
2016-06-23 15:06:49 +02:00
Mike Lischke
4a7ec859aa
Simplified parse tree listener handling.
...
No need to use shared_ptr for management. Listeners are, like the other main classes (parser, lexer, input stream etc.) provided by the application and hence managed there.
2016-06-17 10:22:19 +02:00
Peter Boyer
c8a9d75cfe
Merge pull request #21 from wjkohnen/gofmt
...
tool/Go: gofmt generated code.
2016-06-14 16:26:36 -04:00