Browse Source

pastojs: set Scanner.AllowedModeSwitches

git-svn-id: trunk@35939 -
Mattias Gaertner 8 years ago
parent
commit
89b839d341
2 changed files with 5 additions and 1 deletions
  1. 4 1
      packages/pastojs/src/fppas2js.pp
  2. 1 0
      packages/pastojs/tests/tcmodules.pas

+ 4 - 1
packages/pastojs/src/fppas2js.pp

@@ -246,7 +246,6 @@ Works:
   - use 0o for octal literals
 
 ToDos:
-- overload: jsvalue last,
 - constant evaluation
 - integer ranges
 - static arrays
@@ -262,6 +261,7 @@ ToDos:
 - make -Jirtl.js default for -Jc and -Tnodejs, needs #IFDEF in cfg
 - FuncName:= (instead of Result:=)
 - $modeswitch -> define <modeswitch>
+- scanner: define list of allowed modeswitches
 - $modeswitch- -> turn off
 - check memleaks
 - @@ compare method in delphi mode
@@ -779,6 +779,9 @@ type
 //------------------------------------------------------------------------------
 // TPas2JSResolver
 const
+  msAllPas2jsModeSwitches = [msDelphi,msFpc,msObjfpc,
+    msExternalClass,msHintDirective,msNestedComment];
+
   btAllJSBaseTypes = [
     btChar,
     btString,

+ 1 - 0
packages/pastojs/tests/tcmodules.pas

@@ -652,6 +652,7 @@ begin
   FFileResolver:=TStreamResolver.Create;
   FFileResolver.OwnsStreams:=True;
   FScanner:=TPascalScanner.Create(FFileResolver);
+  FScanner.AllowedModeSwitches:=msAllPas2jsModeSwitches;
   FEngine:=AddModule(Filename);
   FParser:=TTestPasParser.Create(FScanner,FFileResolver,FEngine);
   Parser.Options:=Parser.Options+po_pas2js;