Browse Source

pas2js: bool switches $hints, $notes, $warnings

git-svn-id: trunk@37823 -
Mattias Gaertner 7 years ago
parent
commit
df5a9333a7
2 changed files with 19 additions and 5 deletions
  1. 9 4
      utils/pas2js/docs/translation.html
  2. 10 1
      utils/pas2js/pas2jscompiler.pp

+ 9 - 4
utils/pas2js/docs/translation.html

@@ -2518,10 +2518,15 @@ End.
     <li>{$modeswitch externalclass}: allow declaring external classes</li>
     <li>{$macro on|off} enables macro replacements. Only macros with a custom value are replaced. Macros are never replaced inside directives.</li>
     <li>{$I filename} or {$include filename} - insert include file</li>
-    <li>{$ERROR text}</li>
-    <li>{$WARNING text}</li>
-    <li>{$NOTE text}</li>
-    <li>{$HINT text}</li>
+    <li>{$Warnings on|off}</li>
+    <li>{$Notes on|off}</li>
+    <li>{$Hints on|off}</li>
+    <li>{$Error text}</li>
+    <li>{$Warning text}</li>
+    <li>{$Note text}</li>
+    <li>{$Hint text}</li>
+    <li>{$Message hint-text}</li>
+    <li>{$Message hint|note|warn|error|fatal text}</li>
     <li>{$M+}, {$TypeInfo on}: switches default visibility for class members from public to published</li>
     <li>{$ScopedEnums on|off} disabled/default: propagate enums to global scope, enable: needs fqn e.g. TEnumType.EnumValue.</li>
     </ul>

+ 10 - 1
utils/pas2js/pas2jscompiler.pp

@@ -684,6 +684,7 @@ var
   aUnitName: String;
   i: Integer;
   M: TMacroDef;
+  bs: TBoolSwitches;
 begin
   FFileResolver:=aFileResolver;
   // scanner
@@ -696,10 +697,18 @@ begin
   FParser := TPas2jsPasParser.Create(Scanner, FileResolver, PascalResolver);
 
   // set options
+  Scanner.Options:=Scanner.Options+[po_StopOnErrorDirective];
   Scanner.AllowedModeSwitches:=msAllPas2jsModeSwitches;
   Scanner.ReadOnlyModeSwitches:=msAllPas2jsModeSwitchesReadOnly;
   Scanner.CurrentModeSwitches:=p2jsMode_SwitchSets[Compiler.Mode];
-  Scanner.AllowedBoolSwitches:=msAllPas2jsBoolSwitches;
+  bs:=msAllPas2jsBoolSwitches;
+  if not (coShowHints in Compiler.Options) then
+    Exclude(bs,bsHints);
+  if not (coShowNotes in Compiler.Options) then
+    Exclude(bs,bsNotes);
+  if not (coShowWarnings in Compiler.Options) then
+    Exclude(bs,bsWarnings);
+  Scanner.AllowedBoolSwitches:=bs;
   // Note: some Scanner.Options are set by TPasResolver
   for i:=0 to Compiler.Defines.Count-1 do
     begin