1 |
commit: 9224a1e6a4719813c67adaaa995716aedf319b64 |
2 |
Author: Petteri Räty <petsku <AT> petteriraty <DOT> eu> |
3 |
AuthorDate: Thu Apr 7 07:05:51 2011 +0000 |
4 |
Commit: Petteri Räty <betelgeuse <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Apr 7 07:21:47 2011 +0000 |
6 |
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/libbash.git;a=commit;h=9224a1e6 |
7 |
|
8 |
Simplify first line comment handling |
9 |
|
10 |
Instead of listing all possible tokens just use negation to find the end |
11 |
of the comment. |
12 |
|
13 |
--- |
14 |
bashast/bashast.g | 6 ++---- |
15 |
1 files changed, 2 insertions(+), 4 deletions(-) |
16 |
|
17 |
diff --git a/bashast/bashast.g b/bashast/bashast.g |
18 |
index 01cc0df..7126bdd 100644 |
19 |
--- a/bashast/bashast.g |
20 |
+++ b/bashast/bashast.g |
21 |
@@ -81,12 +81,10 @@ tokens{ |
22 |
MINUS_SIGN; |
23 |
} |
24 |
|
25 |
-start : (flcomment! EOL!)? EOL!* list^ ; |
26 |
+start : (flcomment!)? EOL!* list^ ; |
27 |
//Because the comment token doesn't handle the first comment in a file if it's on the first line, have a parser rule for it |
28 |
flcomment |
29 |
- : BLANK? '#' commentpart*; |
30 |
-commentpart |
31 |
- : nqstr|BLANK|LBRACE|RBRACE|SEMIC|DOUBLE_SEMIC|TICK|LPAREN|RPAREN|LLPAREN|RRPAREN|PIPE|COMMA|SQUOTE|QUOTE|LESS_THAN|GREATER_THAN; |
32 |
+ : '#' ~(EOL)* EOL; |
33 |
list : list_level_2 BLANK* (';'|'&'|EOL)? -> ^(LIST list_level_2); |
34 |
clist |
35 |
options{greedy=false;} |