STYLE: remove unused cruft from flex-based lexers

This commit is contained in:
Mark Olesen
2010-02-25 16:18:34 +01:00
parent 9352e17eed
commit f2f2f60cf5
6 changed files with 49 additions and 88 deletions

View File

@ -91,23 +91,20 @@ cspace ","{space}
alpha [_A-Za-z] alpha [_A-Za-z]
digit [0-9] digit [0-9]
dec_digit [0-9]
octal_digit [0-7]
hex_digit [0-9a-fA-F]
identifier {alpha}({alpha}|{digit})* identifier {alpha}({alpha}|{digit})*
integer {dec_digit}+ integer {digit}+
label [1-9]{dec_digit}* label [1-9]{digit}*
exponent_part [eE][-+]?{digit}+ exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part})) floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
x {double} x {floatNum}
y {double} y {floatNum}
z {double} z {floatNum}
value {double} value {floatNum}
node ^{space}"N"{cspace} node ^{space}"N"{cspace}
element ^{space}"EN"{cspace} element ^{space}"EN"{cspace}

View File

@ -95,24 +95,14 @@ int yyFlexLexer::yywrap()
one_space [ \t\f\r] one_space [ \t\f\r]
space {one_space}* space {one_space}*
some_space {one_space}+ some_space {one_space}+
cspace ","{space}
spaceNl ({space}|\n)* spaceNl ({space}|\n)*
alpha [_[:alpha:]] alpha [_[:alpha:]]
digit [[:digit:]] digit [[:digit:]]
dec_digit [[:digit:]]
octal_digit [0-7]
hex_digit [[:xdigit:]]
lbrac "("
rbrac ")"
quote \"
dash "-"
dotColonDash [.:-] dotColonDash [.:-]
identifier {alpha}({alpha}|{digit})* label [0-9]{digit}*
integer {dec_digit}+
label [0-9]{dec_digit}*
zeroLabel {digit}* zeroLabel {digit}*
word ({alpha}|{digit}|{dotColonDash})* word ({alpha}|{digit}|{dotColonDash})*
@ -120,14 +110,14 @@ word ({alpha}|{digit}|{dotColonDash})*
exponent_part [eE][-+]?{digit}+ exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double ((({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))|0) floatNum ((({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))|0)
x {floatNum}
y {floatNum}
z {floatNum}
x {double}
y {double}
z {double}
scalar {double}
labelListElement {space}{zeroLabel} labelListElement {space}{zeroLabel}
scalarListElement {space}{double} scalarListElement {space}{floatNum}
labelList ({labelListElement}+{space}) labelList ({labelListElement}+{space})
scalarList ({scalarListElement}+{space}) scalarList ({scalarListElement}+{space})

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -152,18 +152,11 @@ STLASCIILexer::STLASCIILexer(istream* is, const label approxNpoints)
one_space [ \t\f\r] one_space [ \t\f\r]
space {one_space}* space {one_space}*
some_space {one_space}+ some_space {one_space}+
cspace ","{space}
alpha [_A-Za-z] alpha [_A-Za-z]
digit [0-9] digit [0-9]
dec_digit [0-9]
octal_digit [0-7]
hex_digit [0-9a-fA-F]
identifier {alpha}({alpha}|{digit})* integer {digit}+
integer {dec_digit}+
label [1-9]{dec_digit}*
zeroLabel {digit}*
signedInteger [-+]?{integer} signedInteger [-+]?{integer}
word ([[:alnum:]]|[[:punct:]])* word ([[:alnum:]]|[[:punct:]])*
@ -172,15 +165,14 @@ string {word}({some_space}{word})*
exponent_part [eE][-+]?{digit}+ exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part})) floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
float {double}
x {float} x {floatNum}
y {float} y {floatNum}
z {float} z {floatNum}
solid {space}("solid"|"SOLID"){space} solid {space}("solid"|"SOLID"){space}
color {space}("color"|"COLOR"){some_space}{float}{some_space}{float}{some_space}{float}{space} color {space}("color"|"COLOR"){some_space}{floatNum}{some_space}{floatNum}{some_space}{floatNum}{space}
facet {space}("facet"|"FACET"){space} facet {space}("facet"|"FACET"){space}
normal {space}("normal"|"NORMAL"){space} normal {space}("normal"|"NORMAL"){space}
point {space}{x}{some_space}{y}{some_space}{z}{space} point {space}{x}{some_space}{y}{some_space}{z}{space}
@ -337,7 +329,7 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
} }
} }
<readVertex>{space}{float}{space} { <readVertex>{space}{floatNum}{space} {
vertex[cmpt++] = atof(YYText()); vertex[cmpt++] = atof(YYText());
if (cmpt == 3) if (cmpt == 3)

View File

@ -1,8 +1,8 @@
/*---------------------------------------------------------------------------*\ /*--------------------------------*- C++ -*----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -103,26 +103,14 @@ Foam::word foamName(const Foam::string& s)
one_space [ \t\f\r] one_space [ \t\f\r]
space {one_space}* space {one_space}*
some_space {one_space}+ some_space {one_space}+
cspace ","{space}
alpha [_A-Za-z] alpha [_A-Za-z]
digit [0-9] digit [0-9]
dec_digit [0-9]
octal_digit [0-7]
hex_digit [0-9a-fA-F]
identifier {alpha}({alpha}|{digit})*
integer {dec_digit}+
label [1-9]{dec_digit}*
zeroLabel {digit}*
word ([[:alnum:]]|[[:punct:]])+
string {word}({some_space}{word})*
exponent_part [eEdD][-+]?{digit}+ exponent_part [eEdD][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part})) floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
elements {space}("ELEMENTS"|"ELEM"){space} elements {space}("ELEMENTS"|"ELEM"){space}
@ -134,10 +122,10 @@ end {space}"END"{space}
elementName {space}([A-Z]|([A-Z][A-Z])){space} elementName {space}([A-Z]|([A-Z][A-Z])){space}
startIsotopeMolW {space}"/"{space} startIsotopeMolW {space}"/"{space}
isotopeMolW {space}{double}{space}"/"{space} isotopeMolW {space}{floatNum}{space}"/"{space}
specieName {space}[A-Za-z](([A-Za-z0-9)*+-])|("("[^+]))*{space} specieName {space}[A-Za-z](([A-Za-z0-9)*+-])|("("[^+]))*{space}
nMoles {space}{double}{space} nMoles {space}{floatNum}{space}
thermoTemp .{10} thermoTemp .{10}
@ -160,13 +148,13 @@ reversibleReactionDelimiter {space}("="|"<=>"){space}
irreversibleReactionDelimiter {space}"=>"{space} irreversibleReactionDelimiter {space}"=>"{space}
startPDependentSpecie {space}"("{space}"+"{space} startPDependentSpecie {space}"("{space}"+"{space}
pDependentSpecie {specieName}")"{space} pDependentSpecie {specieName}")"{space}
reactionCoeffs {space}{double}{some_space}{double}{some_space}{double}{space} reactionCoeffs {space}{floatNum}{some_space}{floatNum}{some_space}{floatNum}{space}
reactionKeyword {space}[A-Za-z](([A-Za-z0-9)*-])|("("[^+]))*{space} reactionKeyword {space}[A-Za-z](([A-Za-z0-9)*-])|("("[^+]))*{space}
reactionKeywordSlash {reactionKeyword}"/"{space} reactionKeywordSlash {reactionKeyword}"/"{space}
thirdBodyEfficiency {space}{double}{space}"/"{space} thirdBodyEfficiency {space}{floatNum}{space}"/"{space}
startReactionCoeffs {space}"/"{space} startReactionCoeffs {space}"/"{space}
endReactionCoeffs {space}"/"{space} endReactionCoeffs {space}"/"{space}
reactionCoeff {space}{double}{space} reactionCoeff {space}{floatNum}{space}
calPerMol {space}"CAL/MOLE"{space} calPerMol {space}"CAL/MOLE"{space}
kcalPerMol {space}"KCAL/MOLE"{space} kcalPerMol {space}"KCAL/MOLE"{space}

View File

@ -2,7 +2,7 @@
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------- -------------------------------------------------------------------------------
License License
@ -153,19 +153,12 @@ STLLexer::STLLexer(istream* is, const label approxNpoints)
one_space [ \t\f\r] one_space [ \t\f\r]
space {one_space}* space {one_space}*
some_space {one_space}+ some_space {one_space}+
cspace ","{space}
alpha [_A-Za-z] alpha [_A-Za-z]
digit [0-9] digit [0-9]
dec_digit [0-9]
octal_digit [0-7]
hex_digit [0-9a-fA-F]
identifier {alpha}({alpha}|{digit})* integer {digit}+
integer {dec_digit}+ signedInteger [-+]?{digit}+
label [1-9]{dec_digit}*
zeroLabel {digit}*
signedInteger [-+]?{integer}
word ([[:alnum:]]|[[:punct:]])* word ([[:alnum:]]|[[:punct:]])*
string {word}({some_space}{word})* string {word}({some_space}{word})*
@ -173,15 +166,14 @@ string {word}({some_space}{word})*
exponent_part [eE][-+]?{digit}+ exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?)) fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part})) floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
float {double}
x {float} x {floatNum}
y {float} y {floatNum}
z {float} z {floatNum}
solid {space}("solid"|"SOLID"){space} solid {space}("solid"|"SOLID"){space}
color {space}("color"|"COLOR"){some_space}{float}{some_space}{float}{some_space}{float}{space} color {space}("color"|"COLOR"){some_space}{floatNum}{some_space}{floatNum}{some_space}{floatNum}{space}
facet {space}("facet"|"FACET"){space} facet {space}("facet"|"FACET"){space}
normal {space}("normal"|"NORMAL"){space} normal {space}("normal"|"NORMAL"){space}
point {space}{x}{some_space}{y}{some_space}{z}{space} point {space}{x}{some_space}{y}{some_space}{z}{space}
@ -320,7 +312,7 @@ endsolid {space}("endsolid"|"ENDSOLID")({some_space}{word})*
} }
} }
<readVertex>{space}{float}{space} { <readVertex>{space}{floatNum}{space} {
vertex[cmpt++] = atof(YYText()); vertex[cmpt++] = atof(YYText());
if (cmpt == 3) if (cmpt == 3)

View File

@ -1,9 +1,9 @@
%{ %{
/*---------------------------------------------------------------------------*\ /*---------------------------------*- C -*-----------------------------------*\
========= | ========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration | \\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd. \\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation | \\/ M anipulation |
------------------------------------------------------------------------------ ------------------------------------------------------------------------------
License License
@ -164,9 +164,11 @@ int main(int argc, char* argv[])
(&sourceFile[strlen(sourceFile) - 1] - dotPtr)/sizeof(char) (&sourceFile[strlen(sourceFile) - 1] - dotPtr)/sizeof(char)
); );
/* initialise depFile to zero and use strncat rather than strncpy /*
because there is a bug in the SGI strncat that if 0 preceeds the . * initialise depFile to zero and use strncat rather than strncpy
it inserts a space */ * because there is a bug in the SGI strncat that if 0 preceeds the '.'
* it inserts a space
*/
depFile = (char*)malloc(strlen(sourceFile) + 3); depFile = (char*)malloc(strlen(sourceFile) + 3);
depFile[0] = 0; depFile[0] = 0;
strncat(depFile, sourceFile, (dotPtr - sourceFile)/sizeof(char)); strncat(depFile, sourceFile, (dotPtr - sourceFile)/sizeof(char));
@ -432,7 +434,7 @@ void importDirectory(const char* dirName)
int yywrap() int yywrap()
{ {
/* Close the file for the buffer which has just reached EOF */ /* Close the file for the buffer which has just reached EOF */
/* This causes strange problems /* This causes strange problems on some systems
fclose(yyin); fclose(yyin);
yyin = 0; yyin = 0;
*/ */