--- a/compiler/PPCTokenizingCodeGenerator.st Fri Jul 24 15:06:54 2015 +0100
+++ b/compiler/PPCTokenizingCodeGenerator.st Mon Aug 17 12:13:16 2015 +0100
@@ -17,9 +17,12 @@
!
tokenGenerator
+ self error: 'deprecated'.
+
tokenGenerator isNil ifTrue: [
- tokenGenerator := PPCTokenCodeGenerator on: compiler.
- tokenGenerator arguments: arguments.
+ tokenGenerator := (PPCTokenCodeGenerator on: compiler)
+ arguments: arguments;
+ yourself.
].
^ tokenGenerator
!
@@ -62,6 +65,12 @@
^ true
! !
+!PPCTokenizingCodeGenerator methodsFor:'scanner'!
+
+compileScanner
+ compiler addConstant: self tokenGenerator compileScanner as: #scannerClass.
+! !
+
!PPCTokenizingCodeGenerator methodsFor:'visiting'!
visitAndNode: node
@@ -91,11 +100,15 @@
node children do: [ :child |
| tokenMethodName |
-
- child acceptsEpsilon ifTrue: [
+
+ "TODO: JK: fix this in a proper way. Commented for now to make LRPParser cimpilable
+ with tokenizing"
+ child acceptsEpsilon "false" ifTrue: [
possibleError := false.
- compiler codeAssignParsedValueOf:[ self visit:child ] to:self retvalVar.
- compiler codeReturn
+ compiler codeIf: 'true' then: [
+ compiler codeAssignParsedValueOf:[ self visit:child ] to:self retvalVar.
+ compiler codeReturn
+ ].
] ifFalse: [
child firstSetWithTokens do: [ :first |
"For each child, for each first compile this:"
@@ -125,7 +138,7 @@
compiler codeError: 'no choice found'.
]
- "Modified: / 10-05-2015 / 07:37:53 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+ "Modified: / 31-07-2015 / 08:07:59 / Jan Vrany <jan.vrany@fit.cvut.cz>"
!
visitDeterministicChoiceNode: node
@@ -183,30 +196,15 @@
!
visitTokenConsumeNode: node
- | id |
- id := (compiler idFor: node child).
- compiler add: 'self ', id asString, ' ifTrue: ['.
- compiler indent.
- compiler codeAssign: 'nil.' to: 'currentTokenType'.
- compiler codeReturn: 'currentTokenValue'.
- compiler dedent.
- compiler add: '] ifFalse: ['.
- compiler indent.
- compiler codeError: id asString, ' expected'.
- compiler dedent.
- compiler add: '].'.
-
-"
- compiler codeReturn: 'self consume: ', (compiler idFor: node child) storeString, '.'
-"
+ "dont do anything here"
+ ^ node
!
visitTokenNode: node
- self error: 'shoudl not happend!!'
+ self error: 'should not happen!!'
!
visitTokenizingParserNode: node
- self visit: node tokenizer.
self visit: node whitespace.
compiler codeHaltIfShiftPressed.
@@ -216,7 +214,11 @@
compiler codeReturn.
!
+visitTrimmingTokenCharacterNode: node
+ self error: 'should not happen!!'
+!
+
visitTrimmingTokenNode: node
- self error: 'shoudl not happend!!'
+ self error: 'should not happen!!'
! !