Updated to work with recent PetitParser default tip
authorJan Vrany <jan.vrany@fit.cvut.cz>
Tue, 04 Nov 2014 00:31:38 +0000
changeset 10 5df5a2f8e4b5
parent 9 ae0dabfd3321
Updated to work with recent PetitParser
compiler/Dart__Parser.st
compiler/Dart__ParserContext.st
compiler/Make.proto
compiler/Make.spec
compiler/abbrev.stc
compiler/bc.mak
compiler/compiler.rc
compiler/ctu_dart_compiler.st
compiler/libInit.cc
--- a/compiler/Dart__Parser.st	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/Dart__Parser.st	Tue Nov 04 00:31:38 2014 +0000
@@ -1,4 +1,4 @@
-"{ Package: 'jv:dart/compiler' }"
+"{ Package: 'ctu:dart/compiler' }"
 
 "{ NameSpace: Dart }"
 
@@ -983,6 +983,16 @@
     "Modified: / 11-01-2013 / 11:35:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
 ! !
 
+!Parser methodsFor:'parsing'!
+
+parse: anObject
+        "Parse anObject with the receiving parser and answer the parse-result or an instance of PPFailure."
+
+        ^ self parse: anObject withContext: ParserContext new
+
+    "Created: / 04-11-2014 / 00:23:51 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
 !Parser::TokenParser class methodsFor:'instance creation'!
 
 for: tokenType
@@ -1030,4 +1040,5 @@
     ^ '$Changeset: <not expanded> $'
 ! !
 
+
 Parser initialize!
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/compiler/Dart__ParserContext.st	Tue Nov 04 00:31:38 2014 +0000
@@ -0,0 +1,48 @@
+"{ Package: 'ctu:dart/compiler' }"
+
+"{ NameSpace: Dart }"
+
+PPContext subclass:#ParserContext
+	instanceVariableNames:'scanner'
+	classVariableNames:''
+	poolDictionaries:''
+	category:'Languages-Dart-Parser'
+!
+
+!ParserContext methodsFor:'accessing'!
+
+stream: aStream
+    super stream: aStream.
+    scanner := Scanner for: aStream.
+
+    "Created: / 04-11-2014 / 00:26:21 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ParserContext methodsFor:'accessing - tokens'!
+
+token
+    ^ scanner token
+
+    "Created: / 04-11-2014 / 00:28:47 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tokenType
+    ^ scanner tokenType
+
+    "Created: / 04-11-2014 / 00:27:52 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+!
+
+tokenValue
+    ^ scanner tokenValue
+
+    "Created: / 04-11-2014 / 00:28:10 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
+!ParserContext methodsFor:'streaming - tokens'!
+
+nextToken
+    ^ scanner nextToken
+
+    "Created: / 04-11-2014 / 00:27:26 / Jan Vrany <jan.vrany@fit.cvut.cz>"
+! !
+
--- a/compiler/Make.proto	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/Make.proto	Tue Nov 04 00:31:38 2014 +0000
@@ -124,6 +124,7 @@
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
 $(OUTDIR)Dart__Parser.$(O) Dart__Parser.$(H): Dart__Parser.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPCompositeParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPDelegateParser.$(H) $(INCLUDE_TOP)/stx/goodies/petitparser/PPParser.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
+$(OUTDIR)Dart__ParserContext.$(O) Dart__ParserContext.$(H): Dart__ParserContext.st $(INCLUDE_TOP)/stx/goodies/petitparser/PPContext.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)Dart__ParserError.$(O) Dart__ParserError.$(H): Dart__ParserError.st $(INCLUDE_TOP)/stx/libbasic/Error.$(H) $(INCLUDE_TOP)/stx/libbasic/Exception.$(H) $(INCLUDE_TOP)/stx/libbasic/GenericException.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)Dart__ScannerBase.$(O) Dart__ScannerBase.$(H): Dart__ScannerBase.st $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(STCHDR)
 $(OUTDIR)ctu_dart_compiler.$(O) ctu_dart_compiler.$(H): ctu_dart_compiler.st $(INCLUDE_TOP)/stx/libbasic/LibraryDefinition.$(H) $(INCLUDE_TOP)/stx/libbasic/Object.$(H) $(INCLUDE_TOP)/stx/libbasic/ProjectDefinition.$(H) $(STCHDR)
--- a/compiler/Make.spec	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/Make.spec	Tue Nov 04 00:31:38 2014 +0000
@@ -51,6 +51,7 @@
 
 COMMON_CLASSES= \
 	Dart::Parser \
+	Dart::ParserContext \
 	Dart::ParserError \
 	Dart::ScannerBase \
 	ctu_dart_compiler \
@@ -63,6 +64,7 @@
 
 COMMON_OBJS= \
     $(OUTDIR_SLASH)Dart__Parser.$(O) \
+    $(OUTDIR_SLASH)Dart__ParserContext.$(O) \
     $(OUTDIR_SLASH)Dart__ParserError.$(O) \
     $(OUTDIR_SLASH)Dart__ScannerBase.$(O) \
     $(OUTDIR_SLASH)ctu_dart_compiler.$(O) \
--- a/compiler/abbrev.stc	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/abbrev.stc	Tue Nov 04 00:31:38 2014 +0000
@@ -2,6 +2,7 @@
 # this file is needed for stc to be able to compile modules independently.
 # it provides information about a classes filename, category and especially namespace.
 Dart::Parser Dart__Parser ctu:dart/compiler 'Languages-Dart-Parser' 0
+Dart::ParserContext Dart__ParserContext ctu:dart/compiler 'Languages-Dart-Parser' 0
 Dart::ParserError Dart__ParserError ctu:dart/compiler 'Languages-Dart-Parser' 1
 Dart::ScannerBase Dart__ScannerBase ctu:dart/compiler 'Languages-Dart-Parser' 3
 ctu_dart_compiler ctu_dart_compiler ctu:dart/compiler '* Projects & Packages *' 3
--- a/compiler/bc.mak	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/bc.mak	Tue Nov 04 00:31:38 2014 +0000
@@ -70,6 +70,7 @@
 
 # BEGINMAKEDEPEND --- do not remove this line; make depend needs it
 $(OUTDIR)Dart__Parser.$(O) Dart__Parser.$(H): Dart__Parser.st $(INCLUDE_TOP)\stx\goodies\petitparser\PPCompositeParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPDelegateParser.$(H) $(INCLUDE_TOP)\stx\goodies\petitparser\PPParser.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
+$(OUTDIR)Dart__ParserContext.$(O) Dart__ParserContext.$(H): Dart__ParserContext.st $(INCLUDE_TOP)\stx\goodies\petitparser\PPContext.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)Dart__ParserError.$(O) Dart__ParserError.$(H): Dart__ParserError.st $(INCLUDE_TOP)\stx\libbasic\Error.$(H) $(INCLUDE_TOP)\stx\libbasic\Exception.$(H) $(INCLUDE_TOP)\stx\libbasic\GenericException.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)Dart__ScannerBase.$(O) Dart__ScannerBase.$(H): Dart__ScannerBase.st $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(STCHDR)
 $(OUTDIR)ctu_dart_compiler.$(O) ctu_dart_compiler.$(H): ctu_dart_compiler.st $(INCLUDE_TOP)\stx\libbasic\LibraryDefinition.$(H) $(INCLUDE_TOP)\stx\libbasic\Object.$(H) $(INCLUDE_TOP)\stx\libbasic\ProjectDefinition.$(H) $(STCHDR)
--- a/compiler/compiler.rc	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/compiler.rc	Tue Nov 04 00:31:38 2014 +0000
@@ -25,7 +25,7 @@
       VALUE "LegalCopyright", "My CopyRight or CopyLeft\0"
       VALUE "ProductName", "ProductName\0"
       VALUE "ProductVersion", "6.2.4.0\0"
-      VALUE "ProductDate", "Tue, 04 Nov 2014 00:16:20 GMT\0"
+      VALUE "ProductDate", "Tue, 04 Nov 2014 00:31:05 GMT\0"
     END
 
   END
--- a/compiler/ctu_dart_compiler.st	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/ctu_dart_compiler.st	Tue Nov 04 00:31:38 2014 +0000
@@ -79,6 +79,7 @@
     ^ #(
         "<className> or (<className> attributes...) in load order"
         #'Dart::Parser'
+        #'Dart::ParserContext'
         #'Dart::ParserError'
         #'Dart::ScannerBase'
         #'ctu_dart_compiler'
--- a/compiler/libInit.cc	Tue Nov 04 00:18:07 2014 +0000
+++ b/compiler/libInit.cc	Tue Nov 04 00:31:38 2014 +0000
@@ -28,6 +28,7 @@
 OBJ snd; struct __vmData__ *__pRT__; {
 __BEGIN_PACKAGE2__("libctu_dart_compiler", _libctu_dart_compiler_Init, "ctu:dart/compiler");
 _Dart__Parser_Init(pass,__pRT__,snd);
+_Dart__ParserContext_Init(pass,__pRT__,snd);
 _Dart__ParserError_Init(pass,__pRT__,snd);
 _Dart__ScannerBase_Init(pass,__pRT__,snd);
 _ctu_137dart_137compiler_Init(pass,__pRT__,snd);