codetools: pas2js: use define instead of mode

git-svn-id: trunk@54285 -
This commit is contained in:
mattias 2017-02-26 22:36:39 +00:00
parent 9a663cc51d
commit 8ab48719ee
3 changed files with 6 additions and 13 deletions

View File

@ -157,8 +157,7 @@ type
cmTP, cmTP,
cmOBJFPC, cmOBJFPC,
cmMacPas, cmMacPas,
cmISO, cmISO
cmPas2Js
); );
{ TCompilerModeSwitch - see fpc/compiler/globtype.pas tmodeswitch } { TCompilerModeSwitch - see fpc/compiler/globtype.pas tmodeswitch }
TCompilerModeSwitch = ( TCompilerModeSwitch = (
@ -230,11 +229,7 @@ const
cmsISOLike_unary_minus,cmsDefault_inline], cmsISOLike_unary_minus,cmsDefault_inline],
// cmISO // cmISO
[cmsTp_procvar,cmsDuplicate_names,cmsNestedProcVars,cmsNonLocalGoto, [cmsTp_procvar,cmsDuplicate_names,cmsNestedProcVars,cmsNonLocalGoto,
cmsISOLike_unary_minus], cmsISOLike_unary_minus]
// cmPas2Js
[cmsNested_comment,cmsRepeat_forward,
cmsInitfinal,cmsHintdirective,cmsProperty,cmsDefault_inline,
cmsResult]
); );
type type
@ -766,8 +761,7 @@ const
'TP', 'TP',
'OBJFPC', 'OBJFPC',
'MACPAS', 'MACPAS',
'ISO', 'ISO'
'PAS2JS'
); );
// upper case (see fpc/compiler/globtype.pas modeswitchstr ) // upper case (see fpc/compiler/globtype.pas modeswitchstr )

View File

@ -2858,7 +2858,7 @@ begin
if (Src[CurPos.StartPos-1]='@') then begin if (Src[CurPos.StartPos-1]='@') then begin
// allow anything behind @ // allow anything behind @
end else if (CurPos.Flag=cafWord) then begin end else if (CurPos.Flag=cafWord) then begin
if Scanner.CompilerMode=cmPas2Js then begin if Scanner.Values.IsDefined('pas2js') then begin
if UnexpectedKeyWordInAsmPas2JSBlock.DoIdentifier(@Src[CurPos.StartPos]) then if UnexpectedKeyWordInAsmPas2JSBlock.DoIdentifier(@Src[CurPos.StartPos]) then
SaveRaiseUnexpectedKeyWordInBeginEndBlock; SaveRaiseUnexpectedKeyWordInBeginEndBlock;
end else if UnexpectedKeyWordInAsmBlock.DoIdentifier(@Src[CurPos.StartPos]) then end else if UnexpectedKeyWordInAsmBlock.DoIdentifier(@Src[CurPos.StartPos]) then

View File

@ -34,13 +34,12 @@ implementation
const const
// CompilerMode names to be shown after -M... // CompilerMode names to be shown after -M...
CompilerModesPretty: array[TCompilerMode] of shortstring = ( CompilerModesPretty: array[TCompilerMode] of shortstring = (
'fpc', 'Delphi', 'DelphiUnicode', 'gpc', 'tp', 'ObjFPC', 'MacPas', 'iso', 'pas2js' 'fpc', 'Delphi', 'DelphiUnicode', 'gpc', 'tp', 'ObjFPC', 'MacPas', 'iso'
); );
// CompilerMode descriptions. // CompilerMode descriptions.
CompilerModesDescr: array[TCompilerMode] of shortstring = ( CompilerModesDescr: array[TCompilerMode] of shortstring = (
'Free Pascal', 'Delphi', 'Delphi Unicode', 'GNU Pascal', 'Turbo Pascal', 'Free Pascal', 'Delphi', 'Delphi Unicode', 'GNU Pascal', 'Turbo Pascal',
'Object Pascal', 'Mac Pascal', 'ISO/IEC 7185 Pascal', 'Object Pascal', 'Mac Pascal', 'ISO/IEC 7185 Pascal'
'Pas2JS - Pascal to JavaScript transpiler'
); );
function SyntaxModeToCaption(const ModeStr: string): string; function SyntaxModeToCaption(const ModeStr: string): string;