reducer.h (ragel-7.0.0.9) | : | reducer.h (ragel-7.0.0.10) | ||
---|---|---|---|---|
/* | ||||
* Copyright 2001-2006 Adrian Thurston <thurston@colm.net> | ||||
* | ||||
* Permission is hereby granted, free of charge, to any person obtaining a copy | ||||
* of this software and associated documentation files (the "Software"), to | ||||
* deal in the Software without restriction, including without limitation the | ||||
* rights to use, copy, modify, merge, publish, distribute, sublicense, and/or | ||||
* sell copies of the Software, and to permit persons to whom the Software is | ||||
* furnished to do so, subject to the following conditions: | ||||
* | ||||
* The above copyright notice and this permission notice shall be included in al | ||||
l | ||||
* copies or substantial portions of the Software. | ||||
* | ||||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||||
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||||
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||||
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||||
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||||
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||||
* SOFTWARE. | ||||
*/ | ||||
#include <colm/pdarun.h> | #include <colm/pdarun.h> | |||
#include <colm/bytecode.h> | #include <colm/bytecode.h> | |||
#include <colm/defs.h> | #include <colm/defs.h> | |||
#include <colm/input.h> | #include <colm/input.h> | |||
#include <colm/tree.h> | #include <colm/tree.h> | |||
#include <colm/program.h> | #include <colm/program.h> | |||
#include <colm/colm.h> | #include <colm/colm.h> | |||
#include <stdio.h> | #include <stdio.h> | |||
#include <stdlib.h> | #include <stdlib.h> | |||
skipping to change at line 29 | skipping to change at line 51 | |||
#include "inputdata.h" | #include "inputdata.h" | |||
#include "parsedata.h" | #include "parsedata.h" | |||
#ifndef _REDUCER_H | #ifndef _REDUCER_H | |||
#define _REDUCER_H | #define _REDUCER_H | |||
char *unescape( const char *s, int slen ); | char *unescape( const char *s, int slen ); | |||
char *unescape( const char *s ); | char *unescape( const char *s ); | |||
struct SectionPass; | struct SectionPass; | |||
struct IncludePass; | ||||
struct TopLevel | struct TopLevel | |||
{ | { | |||
TopLevel( InputData *id, SectionPass *sectionPass, const HostLang *hostLa ng, | TopLevel( InputData *id, const HostLang *hostLang, | |||
MinimizeLevel minimizeLevel, MinimizeOpt minimizeOpt ) | MinimizeLevel minimizeLevel, MinimizeOpt minimizeOpt ) | |||
: | : | |||
id(id), | id(id), | |||
sectionPass(sectionPass), | section(0), | |||
pd(0), | pd(0), | |||
machineSpec(0), | machineSpec(0), | |||
machineName(0), | machineName(0), | |||
includeDepth(0), | includeDepth(0), | |||
hostLang(hostLang), | hostLang(hostLang), | |||
minimizeLevel(minimizeLevel), | minimizeLevel(minimizeLevel), | |||
minimizeOpt(minimizeOpt), | minimizeOpt(minimizeOpt), | |||
/* Should be passed into the load, somehow. */ | /* Should be passed into the load, somehow. */ | |||
targetMachine(0), | targetMachine(0), | |||
searchMachine(0), | searchMachine(0), | |||
paramList(0), | paramList(0), | |||
success(true) | success(true), | |||
isImport(false) | ||||
{ | { | |||
exportContext.append( false ); | exportContext.append( false ); | |||
} | } | |||
InputData *id; | InputData *id; | |||
Section *section; | ||||
SectionPass *sectionPass; | SectionPass *sectionPass; | |||
ParseData *pd; | ParseData *pd; | |||
char *machineSpec; | char *machineSpec; | |||
char *machineName; | char *machineName; | |||
int includeDepth; | int includeDepth; | |||
const HostLang *hostLang; | const HostLang *hostLang; | |||
MinimizeLevel minimizeLevel; | MinimizeLevel minimizeLevel; | |||
MinimizeOpt minimizeOpt; | MinimizeOpt minimizeOpt; | |||
std::vector<std::string> writeArgs; | std::vector<std::string> writeArgs; | |||
skipping to change at line 83 | skipping to change at line 105 | |||
const char *searchMachine; | const char *searchMachine; | |||
ActionParamList *paramList; | ActionParamList *paramList; | |||
bool success; | bool success; | |||
/* Generated and called by colm. */ | /* Generated and called by colm. */ | |||
void commit_reduce_forward( program_t *prg, tree_t **root, | void commit_reduce_forward( program_t *prg, tree_t **root, | |||
struct pda_run *pda_run, parse_tree_t *pt ); | struct pda_run *pda_run, parse_tree_t *pt ); | |||
void loadMachineName( string data ); | void loadMachineName( string data ); | |||
void tryMachineDef( InputLoc &loc, std::string name, | void tryMachineDef( const InputLoc &loc, std::string name, | |||
MachineDef *machineDef, bool isInstance ); | MachineDef *machineDef, bool isInstance ); | |||
long tryLongScan( const InputLoc &loc, const char *data ); | long tryLongScan( const InputLoc &loc, const char *data ); | |||
void loadImport( std::string fileName ); | ||||
void include( const InputLoc &incLoc, string fileName, string machine ); | ||||
void reduceFile( const char *inputFileName ); | ||||
void reduceStr( const char *inputFileName, const char *input ); | ||||
void topReduce( const char *inputFileName ); | ||||
void loadIncludeData( IncludeRec *el, IncludePass &includePass, const str | ||||
ing &fileName ); | ||||
void include( const InputLoc &incLoc, bool fileSpecified, string fileName , string machine ); | void include( const InputLoc &incLoc, bool fileSpecified, string fileName , string machine ); | |||
}; | void reduceFile( const char *inputFileName, bool import ); | |||
struct SectionPass | void import( const InputLoc &loc, std::string name, Literal *literal ); | |||
{ | void importFile( std::string fileName ); | |||
SectionPass( InputData *id ) | ||||
: | ||||
id(id), | ||||
section(0) | ||||
{ | ||||
} | ||||
InputData *id; | ||||
Section *section; | ||||
void reduceFile( const char *inputFileName ); | ||||
void reduceStr( const char *inputFileName, const char *input ); | ||||
/* Generated and called by colm. */ | bool isImport; | |||
void commit_reduce_forward( program_t *prg, tree_t **root, | ||||
struct pda_run *pda_run, parse_tree_t *pt ); | ||||
}; | ||||
struct IncludePass | ||||
{ | ||||
IncludePass( InputData *id, const string targetMachine ) | ||||
: | ||||
id(id), | ||||
targetMachine(targetMachine), | ||||
section(0) | ||||
{ | ||||
} | ||||
InputData *id; | ||||
const string targetMachine; | ||||
string sectionMachine; | ||||
Section *section; | ||||
IncItemList incItems; | ||||
SectionDict sectionDict2; | ||||
void reduceFile( const char *inputFileName, const HostLang *hostLang ); | ||||
void reduceStr( const char *inputFileName, const HostLang *hostLang, cons | ||||
t char *input ); | ||||
/* Generated and called by colm. */ | ||||
void commit_reduce_forward( program_t *prg, tree_t **root, | ||||
struct pda_run *pda_run, parse_tree_t *pt ); | ||||
}; | }; | |||
#endif | #endif | |||
End of changes. 11 change blocks. | ||||
59 lines changed or deleted | 33 lines changed or added |