(* it is advisable not to edit this file as it was automatically generated from the grammer file ../../gcc-3.3.1/gcc/gm2/bnf/m2.bnf *) (* Copyright (C) 2001, 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GNU Modula-2. GNU Modula-2 is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2, or (at your option) any later version. GNU Modula-2 is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with gm2; see the file COPYING. If not, write to the Free Software Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. *) MODULE program2 ; FROM M2LexBuf IMPORT currentstring, currenttoken, GetToken, InsertToken, InsertTokenAndRewind, GetTokenNo ; FROM M2Error IMPORT WriteFormat0, WriteFormat1, ErrorStringAt ; FROM M2Quads IMPORT PushT, PushTF, IsAutoPushOn, PushAutoOff, PushAutoOn, PopAuto, DisplayStack ; FROM M2Reserved IMPORT tokToTok, toktype, NulTok, ImportTok, ExportTok, QualifiedTok, UnQualifiedTok, BuiltinTok ; FROM NameKey IMPORT Name, NulName ; FROM StrLib IMPORT StrCopy, StrConCat, StrEqual ; FROM P2SymBuild IMPORT BuildString, BuildNumber ; FROM DynamicStrings IMPORT String, InitString, KillString, Mark, ConCat, ConCatChar ; FROM M2Debug IMPORT Assert ; FROM M2Printf IMPORT printf0 ; (* imports for Pass1 *) FROM M2Quads IMPORT PushT, PopT, StartBuildInit, EndBuildInit, BuildProcedureStart, BuildProcedureEnd, BuildAssignment ; FROM P1SymBuild IMPORT P1StartBuildProgramModule, P1EndBuildProgramModule, P1StartBuildDefinitionModule, P1EndBuildDefinitionModule, P1StartBuildImplementationModule, P1EndBuildImplementationModule, StartBuildInnerModule, EndBuildInnerModule, BuildImportOuterModule, BuildImportInnerModule, BuildExportOuterModule, BuildExportInnerModule, CheckExplicitExported, BuildHiddenType, BuildNulName, StartBuildEnumeration, EndBuildEnumeration, BuildProcedureHeading, StartBuildProcedure, EndBuildProcedure ; FROM SymbolTable IMPORT MakeGnuAsm, PutGnuAsmVolatile, PutGnuAsm, PutGnuAsmInput, PutGnuAsmOutput, PutGnuAsmTrash, PutGnuAsmVolatile, MakeRegInterface, PutRegInterface, GetRegInterface, GetSymName, NulSym ; CONST Pass1 = TRUE ; VAR LastIdent : Name ; PROCEDURE ErrorString (s: String) ; BEGIN END ErrorString ; PROCEDURE ErrorArray (a: ARRAY OF CHAR) ; BEGIN END ErrorArray ; (* expecting token set defined as an enumerated type (eoftok, plustok, minustok, timestok, dividetok, becomestok, ambersandtok, periodtok, commatok, semicolontok, lparatok, rparatok, lsbratok, rsbratok, lcbratok, rcbratok, uparrowtok, singlequotetok, equaltok, hashtok, lesstok, greatertok, lessgreatertok, lessequaltok, greaterequaltok, periodperiodtok, colontok, doublequotestok, bartok, andtok, arraytok, begintok, bytok, casetok, consttok, definitiontok, divtok, dotok, elsetok, elsiftok, endtok, exittok, exporttok, fortok, fromtok, iftok, implementationtok, importtok, intok, looptok, modtok, moduletok, nottok, oftok, ortok, pointertok, proceduretok, qualifiedtok, unqualifiedtok, recordtok, repeattok, returntok, settok, thentok, totok, typetok, untiltok, vartok, whiletok, withtok, asmtok, volatiletok, periodperiodperiodtok, datetok, linetok, filetok, attributetok, builtintok, integertok, identtok, realtok, stringtok) ; *) TYPE SetOfStop0 = SET OF [eoftok..begintok] ; SetOfStop1 = SET OF [bytok..thentok] ; SetOfStop2 = SET OF [totok..stringtok] ; (* DescribeStop - issues a message explaining what tokens were expected *) PROCEDURE DescribeStop (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) : String ; BEGIN RETURN NIL END DescribeStop ; (* DescribeError - issues a message explaining what tokens were expected *) PROCEDURE DescribeError (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END DescribeError ; (* SyntaxError - after a syntax error we skip all tokens up until we reach a stop symbol. *) PROCEDURE SyntaxError (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END SyntaxError ; (* SyntaxCheck - *) PROCEDURE SyntaxCheck (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END SyntaxCheck ; (* WarnMissingToken - generates a warning message about a missing token, t. *) PROCEDURE WarnMissingToken (t: toktype) ; BEGIN END WarnMissingToken ; (* MissingToken - generates a warning message about a missing token, t. *) PROCEDURE MissingToken (t: toktype) ; BEGIN END MissingToken ; (* CheckAndInsert - *) PROCEDURE CheckAndInsert (t: toktype; stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) : BOOLEAN ; BEGIN RETURN TRUE END CheckAndInsert ; (* InStopSet *) PROCEDURE InStopSet (t: toktype; stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) : BOOLEAN ; BEGIN RETURN TRUE END InStopSet ; (* PeepToken - peep token checks to see whether the stopset is satisfied by currenttoken If it is not then it will insert a token providing the token is one of ; ] ) } . OF END , if the stopset contains then we do not insert a token *) PROCEDURE PeepToken (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END PeepToken ; (* Expect - *) PROCEDURE Expect (t: toktype; stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END Expect ; (* CompilationUnit - returns TRUE if the input was correct enough to parse in future passes. *) PROCEDURE CompilationUnit () : BOOLEAN ; BEGIN RETURN TRUE END CompilationUnit ; (* Ident - error checking varient of Ident *) PROCEDURE Ident (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END Ident ; (* PossiblyExportIdent - error checking varient of Ident which also checks to see if this ident should be explicitly exported. *) PROCEDURE PossiblyExportIdent (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END PossiblyExportIdent ; PROCEDURE string (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END string ; PROCEDURE Integer (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END Integer ; PROCEDURE Real (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN END Real ; PROCEDURE FileUnit (stopset0: SetOfStop0; stopset1: SetOfStop1; stopset2: SetOfStop2) ; BEGIN IF currenttoken=definitiontok THEN ELSIF ((currenttoken>=bytok) AND (currenttoken=bytok) AND (currenttoken