"{ Package: 'jv:dart/compiler' }"
"{ NameSpace: Dart }"
PPCompositeParser subclass:#Parser
instanceVariableNames:''
classVariableNames:''
poolDictionaries:''
category:'Languages-Dart-Parser'
!
PPParser subclass:#TokenParser
instanceVariableNames:'tokenType'
classVariableNames:''
poolDictionaries:''
privateIn:Parser
!
!Parser::TokenParser class methodsFor:'instance creation'!
for: tokenType
^self new tokenType: tokenType
"Created: / 14-03-2012 / 23:10:29 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Parser::TokenParser methodsFor:'accessing'!
tokenType
^ tokenType
!
tokenType:aSymbol
tokenType := aSymbol.
! !
!Parser::TokenParser methodsFor:'parsing'!
parseOn:aJavaScanner
"Parse aStream with the receiving parser and answer the parse-result or an instance of PPFailure.
Override this method in subclasses to specify custom parse behavior. Do not call this method from outside,
instead use #parse:."
| pos |
pos := aJavaScanner position.
^(aJavaScanner nextToken = tokenType) ifTrue:[
aJavaScanner token
] ifFalse:[
aJavaScanner position: pos.
PPFailure message: (tokenType printString , ' token expected (got ', aJavaScanner tokenType , ' {',(aJavaScanner tokenValue ? '<nil>') printString,'})') at: aJavaScanner position
]
"Modified: / 17-03-2012 / 13:34:15 / Jan Vrany <jan.vrany@fit.cvut.cz>"
! !
!Parser class methodsFor:'documentation'!
version_HG
^ '$Changeset: <not expanded> $'
! !