--- a/compiler/PPCChoiceNode.st Wed Nov 19 10:52:37 2014 +0000
+++ b/compiler/PPCChoiceNode.st Mon Nov 24 00:09:23 2014 +0000
@@ -19,8 +19,9 @@
!
compileWith: compiler effect: effect id: id
- | firsts guard |
+ | firsts guard whitespaceConsumed |
+ whitespaceConsumed := false.
firsts := (self firstSetSuchThat: [ :e | (e isKindOf: PPCTrimmingTokenNode) or: [ e isTerminal ] ]).
compiler startMethod: id.
@@ -29,12 +30,16 @@
"If we start with trimming token, we should invoke the whitespace parser"
(firsts allSatisfy: [ :e | e isKindOf: PPCTrimmingTokenNode ]) ifTrue: [
firsts anyOne compileWhitespace: compiler.
+ whitespaceConsumed := true.
].
- (1 to: children size) do: [ :idx | |child|
+ (1 to: children size) do: [ :idx | |child allowGuard |
child := children at: idx.
-
- (compiler guards and: [ (guard := PPCGuard on: child) makesSense ]) ifTrue: [
+" allowGuard := ((child isKindOf: PPCTrimmingTokenNode) and: [ whitespaceConsumed not ]) not.
+"
+ allowGuard := whitespaceConsumed.
+
+ (allowGuard and: [compiler guards and: [ (guard := PPCGuard on: child) makesSense ]]) ifTrue: [
guard id: (compiler idFor: guard prefixed: #guard).
guard compileGuard: compiler.
compiler add: ' ifTrue: [ '.