INCLUDE keyword now used for include files. USES *must* be first statement.
This commit is contained in:
parent
762abd4e6e
commit
5c4f5db288
|
@ -4723,3 +4723,13 @@
|
||||||
similar to how it works in a Unix environment. This will help prevent
|
similar to how it works in a Unix environment. This will help prevent
|
||||||
a person from accidentally logging into a node that is being used during
|
a person from accidentally logging into a node that is being used during
|
||||||
a local login.
|
a local login.
|
||||||
|
|
||||||
|
+ Mystic now sends IAC_DO_BINARY as part of the starting telnet negotiations
|
||||||
|
done by MIS. This will help fix some weird issues with Linux/OSX default
|
||||||
|
telnet command line client.
|
||||||
|
|
||||||
|
+ In MPL including a file has been changed to its own keyword as opposed to
|
||||||
|
minicing a compile directive:
|
||||||
|
|
||||||
|
Old: {$include myfile.mps}
|
||||||
|
New: include myfile.mps
|
||||||
|
|
|
@ -60,7 +60,7 @@ Const
|
||||||
colEditPosBar = 9 + 1 * 16;
|
colEditPosBar = 9 + 1 * 16;
|
||||||
|
|
||||||
Const
|
Const
|
||||||
Keywords = 23;
|
Keywords = 24;
|
||||||
Keyword : Array[1..Keywords] of String[9] = (
|
Keyword : Array[1..Keywords] of String[9] = (
|
||||||
( 'AND' ),
|
( 'AND' ),
|
||||||
( 'BEGIN' ),
|
( 'BEGIN' ),
|
||||||
|
@ -73,6 +73,7 @@ Const
|
||||||
( 'FOR' ),
|
( 'FOR' ),
|
||||||
( 'FUNCTION' ),
|
( 'FUNCTION' ),
|
||||||
( 'IF' ),
|
( 'IF' ),
|
||||||
|
( 'INCLUDE' ),
|
||||||
( 'NOT' ),
|
( 'NOT' ),
|
||||||
( 'OF' ),
|
( 'OF' ),
|
||||||
( 'OR' ),
|
( 'OR' ),
|
||||||
|
|
|
@ -84,6 +84,7 @@ Type
|
||||||
LastCharPos : LongInt;
|
LastCharPos : LongInt;
|
||||||
IdentStr : String;
|
IdentStr : String;
|
||||||
AllowOutput : Boolean;
|
AllowOutput : Boolean;
|
||||||
|
GotBlock : Boolean;
|
||||||
UpdateProc : TParserUpdateProc;
|
UpdateProc : TParserUpdateProc;
|
||||||
UpdateInfo : TParserUpdateInfo;
|
UpdateInfo : TParserUpdateInfo;
|
||||||
VarData : VarDataRec;
|
VarData : VarDataRec;
|
||||||
|
@ -109,6 +110,7 @@ Type
|
||||||
Procedure PrevChar;
|
Procedure PrevChar;
|
||||||
Function GetStr (Str: String; Forced, CheckSpace: Boolean) : Boolean;
|
Function GetStr (Str: String; Forced, CheckSpace: Boolean) : Boolean;
|
||||||
Function GetIdent (Forced: Boolean) : Boolean;
|
Function GetIdent (Forced: Boolean) : Boolean;
|
||||||
|
Function GetDirective : String;
|
||||||
Function IsEndOfLine : Boolean;
|
Function IsEndOfLine : Boolean;
|
||||||
Function CurFilePos : LongInt;
|
Function CurFilePos : LongInt;
|
||||||
Procedure SavePosition;
|
Procedure SavePosition;
|
||||||
|
@ -439,7 +441,7 @@ Begin
|
||||||
CloseSourceFile;
|
CloseSourceFile;
|
||||||
UpdateInfo := InFile[CurFile].SavedInfo;
|
UpdateInfo := InFile[CurFile].SavedInfo;
|
||||||
LoadPosition;
|
LoadPosition;
|
||||||
GetChar; // read the } of the include ?
|
// GetChar; // read the } of the include ?
|
||||||
End Else
|
End Else
|
||||||
Error (mpsEndOfFile, '');
|
Error (mpsEndOfFile, '');
|
||||||
|
|
||||||
|
@ -462,21 +464,22 @@ Begin
|
||||||
Result := Ch in [#10, #13];
|
Result := Ch in [#10, #13];
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
Function TParserEngine.GetDirective : String;
|
||||||
|
Begin
|
||||||
|
Result := '';
|
||||||
|
|
||||||
|
Repeat
|
||||||
|
GetChar;
|
||||||
|
|
||||||
|
If Ch in [#10, #13, '}'] Then Break;
|
||||||
|
|
||||||
|
Result := Result + LoCase(Ch);
|
||||||
|
Until UpdateInfo.ErrorType <> 0;
|
||||||
|
|
||||||
|
Result := strStripB(Result, ' ');
|
||||||
|
End;
|
||||||
|
|
||||||
Procedure TParserEngine.NextChar;
|
Procedure TParserEngine.NextChar;
|
||||||
|
|
||||||
Function GetDirective : String;
|
|
||||||
Begin
|
|
||||||
Result := '';
|
|
||||||
|
|
||||||
Repeat
|
|
||||||
GetChar;
|
|
||||||
If Ch = '}' Then Break;
|
|
||||||
Result := Result + LoCase(Ch);
|
|
||||||
Until UpdateInfo.ErrorType <> 0;
|
|
||||||
|
|
||||||
Result := strStripB(Result, ' ');
|
|
||||||
End;
|
|
||||||
|
|
||||||
Var
|
Var
|
||||||
BlockCount : Byte;
|
BlockCount : Byte;
|
||||||
BlockStart : Char;
|
BlockStart : Char;
|
||||||
|
@ -537,13 +540,6 @@ Begin
|
||||||
|
|
||||||
If Ch = '$' Then Begin
|
If Ch = '$' Then Begin
|
||||||
If GetIdent(False) Then Begin
|
If GetIdent(False) Then Begin
|
||||||
If IdentStr = 'include' Then Begin
|
|
||||||
Str := GetDirective;
|
|
||||||
SavePosition;
|
|
||||||
InFile[CurFile].SavedInfo := UpdateInfo;
|
|
||||||
OpenSourceFile(Str);
|
|
||||||
If UpdateInfo.ErrorType <> 0 Then Exit;
|
|
||||||
End Else
|
|
||||||
If IdentStr = 'syntax' Then Begin
|
If IdentStr = 'syntax' Then Begin
|
||||||
Str := GetDirective;
|
Str := GetDirective;
|
||||||
If Str = 'pascal' Then Begin
|
If Str = 'pascal' Then Begin
|
||||||
|
@ -581,14 +577,6 @@ Begin
|
||||||
|
|
||||||
Case Ch of
|
Case Ch of
|
||||||
'$' : If (BlockCount = 1) And GetIdent(False) Then Begin
|
'$' : If (BlockCount = 1) And GetIdent(False) Then Begin
|
||||||
If IdentStr = 'include' Then Begin
|
|
||||||
Str := GetDirective;
|
|
||||||
SavePosition;
|
|
||||||
InFile[CurFile].SavedInfo := UpdateInfo;
|
|
||||||
OpenSourceFile(Str);
|
|
||||||
If UpdateInfo.ErrorType <> 0 Then Exit;
|
|
||||||
Break;
|
|
||||||
End Else
|
|
||||||
If IdentStr = 'syntax' Then Begin
|
If IdentStr = 'syntax' Then Begin
|
||||||
Str := GetDirective;
|
Str := GetDirective;
|
||||||
If Str = 'pascal' Then Begin
|
If Str = 'pascal' Then Begin
|
||||||
|
@ -1785,11 +1773,6 @@ Begin
|
||||||
End;
|
End;
|
||||||
End;
|
End;
|
||||||
|
|
||||||
// problem w const is if include file is right after last const.. ie:
|
|
||||||
// const
|
|
||||||
// blah = 'hi';
|
|
||||||
// {$include blah.mps}
|
|
||||||
|
|
||||||
Procedure TParserEngine.DefineConst;
|
Procedure TParserEngine.DefineConst;
|
||||||
Begin
|
Begin
|
||||||
If CurConstNum = mplMaxConsts Then
|
If CurConstNum = mplMaxConsts Then
|
||||||
|
@ -2657,6 +2640,7 @@ Var
|
||||||
GotOpen : Boolean; // make parsemode var to replace all these bools
|
GotOpen : Boolean; // make parsemode var to replace all these bools
|
||||||
GotVar : Boolean;
|
GotVar : Boolean;
|
||||||
GotConst : Boolean;
|
GotConst : Boolean;
|
||||||
|
IncName : String;
|
||||||
Begin
|
Begin
|
||||||
GotOpen := CheckBlock;
|
GotOpen := CheckBlock;
|
||||||
GotVar := False;
|
GotVar := False;
|
||||||
|
@ -2683,6 +2667,15 @@ Begin
|
||||||
// being lazy and not rewriting all the token parsing... that would
|
// being lazy and not rewriting all the token parsing... that would
|
||||||
// speed up parsing... but meh its only the compiler who cares lol
|
// speed up parsing... but meh its only the compiler who cares lol
|
||||||
|
|
||||||
|
If GetStr(tkw[wInclude], False, False) Then Begin
|
||||||
|
IncName := GetDirective;
|
||||||
|
|
||||||
|
SavePosition;
|
||||||
|
|
||||||
|
InFile[CurFile].SavedInfo := UpdateInfo;
|
||||||
|
|
||||||
|
OpenSourceFile(IncName);
|
||||||
|
End Else
|
||||||
If GetStr(tkw[wBlockOpen], False, False) Then Begin
|
If GetStr(tkw[wBlockOpen], False, False) Then Begin
|
||||||
If GotOpen And Not OneLine Then Begin
|
If GotOpen And Not OneLine Then Begin
|
||||||
PrevChar;
|
PrevChar;
|
||||||
|
@ -2745,9 +2738,15 @@ Begin
|
||||||
If GetStr(tkw[wExit], False, False) Then
|
If GetStr(tkw[wExit], False, False) Then
|
||||||
OutString (Char(opExit))
|
OutString (Char(opExit))
|
||||||
Else
|
Else
|
||||||
If GetStr(tkw[wUses], False, False) Then
|
If GetStr(tkw[wUses], False, False) Then Begin
|
||||||
StatementUses
|
If GotBlock Then
|
||||||
Else Begin
|
Error(mpsSyntaxError, 'USES must be first statement')
|
||||||
|
Else Begin
|
||||||
|
StatementUses;
|
||||||
|
GotBlock := False;
|
||||||
|
Continue;
|
||||||
|
End;
|
||||||
|
End Else Begin
|
||||||
NextChar;
|
NextChar;
|
||||||
|
|
||||||
If Ch in chIdent1 Then Begin
|
If Ch in chIdent1 Then Begin
|
||||||
|
@ -2766,6 +2765,8 @@ Begin
|
||||||
End Else
|
End Else
|
||||||
Error (mpsSyntaxError, '');
|
Error (mpsSyntaxError, '');
|
||||||
End;
|
End;
|
||||||
|
|
||||||
|
GotBlock := True;
|
||||||
Until (UpdateInfo.ErrorType <> 0) or OneLine;
|
Until (UpdateInfo.ErrorType <> 0) or OneLine;
|
||||||
|
|
||||||
For Count := CurVarNum DownTo SavedVar + 1 Do
|
For Count := CurVarNum DownTo SavedVar + 1 Do
|
||||||
|
@ -2859,6 +2860,7 @@ Begin
|
||||||
UsesMGROUP := False;
|
UsesMGROUP := False;
|
||||||
UsesFBASE := False;
|
UsesFBASE := False;
|
||||||
UsesFGROUP := False;
|
UsesFGROUP := False;
|
||||||
|
GotBlock := False;
|
||||||
|
|
||||||
Assign (OutFile, JustFileName(FN) + mplExtExecute);
|
Assign (OutFile, JustFileName(FN) + mplExtExecute);
|
||||||
ReWrite (OutFile, 1);
|
ReWrite (OutFile, 1);
|
||||||
|
|
|
@ -167,7 +167,7 @@ Type
|
||||||
wCaseOf, wNumRange, wType, wConst,
|
wCaseOf, wNumRange, wType, wConst,
|
||||||
wBreak, wContinue, wUses, wExit,
|
wBreak, wContinue, wUses, wExit,
|
||||||
wHexPrefix, wExpAnd, wExpOr, wExpXor,
|
wHexPrefix, wExpAnd, wExpOr, wExpXor,
|
||||||
wExpShl, wExpShr);
|
wExpShl, wExpShr, wInclude);
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
|
||||||
|
@ -200,7 +200,7 @@ Const
|
||||||
'of', '..', 'type', 'const',
|
'of', '..', 'type', 'const',
|
||||||
'break', 'continue', 'uses', 'exit',
|
'break', 'continue', 'uses', 'exit',
|
||||||
'$', 'and', 'or', 'xor',
|
'$', 'and', 'or', 'xor',
|
||||||
'shl', 'shr'
|
'shl', 'shr', 'include'
|
||||||
);
|
);
|
||||||
|
|
||||||
wTokensIPLC : TTokenWordType = (
|
wTokensIPLC : TTokenWordType = (
|
||||||
|
@ -220,7 +220,7 @@ Const
|
||||||
'of', '..', 'type', 'const',
|
'of', '..', 'type', 'const',
|
||||||
'break', 'continue', 'uses', 'exit',
|
'break', 'continue', 'uses', 'exit',
|
||||||
'$', '&', '|', 'xor',
|
'$', '&', '|', 'xor',
|
||||||
'<<', '>>'
|
'<<', '>>', 'include'
|
||||||
);
|
);
|
||||||
|
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
Loading…
Reference in New Issue