Commit f2f2f60c authored by Mark Olesen's avatar Mark Olesen
Browse files

STYLE: remove unused cruft from flex-based lexers

parent 9352e17e
......@@ -91,23 +91,20 @@ cspace ","{space}
alpha [_A-Za-z]
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}*
integer {digit}+
label [1-9]{digit}*
exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
x {double}
y {double}
z {double}
value {double}
x {floatNum}
y {floatNum}
z {floatNum}
value {floatNum}
node ^{space}"N"{cspace}
element ^{space}"EN"{cspace}
......
......@@ -95,24 +95,14 @@ int yyFlexLexer::yywrap()
one_space [ \t\f\r]
space {one_space}*
some_space {one_space}+
cspace ","{space}
spaceNl ({space}|\n)*
alpha [_[:alpha:]]
digit [[:digit:]]
dec_digit [[:digit:]]
octal_digit [0-7]
hex_digit [[:xdigit:]]
lbrac "("
rbrac ")"
quote \"
dash "-"
dotColonDash [.:-]
identifier {alpha}({alpha}|{digit})*
integer {dec_digit}+
label [0-9]{dec_digit}*
dotColonDash [.:-]
label [0-9]{digit}*
zeroLabel {digit}*
word ({alpha}|{digit}|{dotColonDash})*
......@@ -120,14 +110,14 @@ word ({alpha}|{digit}|{dotColonDash})*
exponent_part [eE][-+]?{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}
scalarListElement {space}{double}
scalarListElement {space}{floatNum}
labelList ({labelListElement}+{space})
scalarList ({scalarListElement}+{space})
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -152,18 +152,11 @@ STLASCIILexer::STLASCIILexer(istream* is, const label approxNpoints)
one_space [ \t\f\r]
space {one_space}*
some_space {one_space}+
cspace ","{space}
alpha [_A-Za-z]
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}*
integer {digit}+
signedInteger [-+]?{integer}
word ([[:alnum:]]|[[:punct:]])*
......@@ -172,15 +165,14 @@ string {word}({some_space}{word})*
exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
float {double}
floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
x {float}
y {float}
z {float}
x {floatNum}
y {floatNum}
z {floatNum}
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}
normal {space}("normal"|"NORMAL"){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());
if (cmpt == 3)
......
/*---------------------------------------------------------------------------*\
/*--------------------------------*- C++ -*----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -103,26 +103,14 @@ Foam::word foamName(const Foam::string& s)
one_space [ \t\f\r]
space {one_space}*
some_space {one_space}+
cspace ","{space}
alpha [_A-Za-z]
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}+
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}
......@@ -134,10 +122,10 @@ end {space}"END"{space}
elementName {space}([A-Z]|([A-Z][A-Z])){space}
startIsotopeMolW {space}"/"{space}
isotopeMolW {space}{double}{space}"/"{space}
isotopeMolW {space}{floatNum}{space}"/"{space}
specieName {space}[A-Za-z](([A-Za-z0-9)*+-])|("("[^+]))*{space}
nMoles {space}{double}{space}
nMoles {space}{floatNum}{space}
thermoTemp .{10}
......@@ -160,13 +148,13 @@ reversibleReactionDelimiter {space}("="|"<=>"){space}
irreversibleReactionDelimiter {space}"=>"{space}
startPDependentSpecie {space}"("{space}"+"{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}
reactionKeywordSlash {reactionKeyword}"/"{space}
thirdBodyEfficiency {space}{double}{space}"/"{space}
thirdBodyEfficiency {space}{floatNum}{space}"/"{space}
startReactionCoeffs {space}"/"{space}
endReactionCoeffs {space}"/"{space}
reactionCoeff {space}{double}{space}
reactionCoeff {space}{floatNum}{space}
calPerMol {space}"CAL/MOLE"{space}
kcalPerMol {space}"KCAL/MOLE"{space}
......
......@@ -2,7 +2,7 @@
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
-------------------------------------------------------------------------------
License
......@@ -153,19 +153,12 @@ STLLexer::STLLexer(istream* is, const label approxNpoints)
one_space [ \t\f\r]
space {one_space}*
some_space {one_space}+
cspace ","{space}
alpha [_A-Za-z]
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}*
signedInteger [-+]?{integer}
integer {digit}+
signedInteger [-+]?{digit}+
word ([[:alnum:]]|[[:punct:]])*
string {word}({some_space}{word})*
......@@ -173,15 +166,14 @@ string {word}({some_space}{word})*
exponent_part [eE][-+]?{digit}+
fractional_constant [-+]?(({digit}*"."{digit}+)|({digit}+"."?))
double (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
float {double}
floatNum (({fractional_constant}{exponent_part}?)|({digit}+{exponent_part}))
x {float}
y {float}
z {float}
x {floatNum}
y {floatNum}
z {floatNum}
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}
normal {space}("normal"|"NORMAL"){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());
if (cmpt == 3)
......
%{
/*---------------------------------------------------------------------------*\
/*---------------------------------*- C -*-----------------------------------*\
========= |
\\ / F ield | OpenFOAM: The Open Source CFD Toolbox
\\ / O peration |
\\ / A nd | Copyright (C) 1991-2009 OpenCFD Ltd.
\\ / A nd | Copyright (C) 1991-2010 OpenCFD Ltd.
\\/ M anipulation |
------------------------------------------------------------------------------
License
......@@ -52,7 +52,7 @@ void nextFile(const char* fileName);
void importFile(const char* fileName);
void importDirectory(const char* dirName);
# undef yywrap /* sometimes a macro by default */
# undef yywrap /* sometimes a macro by default */
%}
......@@ -164,9 +164,11 @@ int main(int argc, char* argv[])
(&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 .
it inserts a space */
/*
* initialise depFile to zero and use strncat rather than strncpy
* 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[0] = 0;
strncat(depFile, sourceFile, (dotPtr - sourceFile)/sizeof(char));
......@@ -432,7 +434,7 @@ void importDirectory(const char* dirName)
int yywrap()
{
/* Close the file for the buffer which has just reached EOF */
/* This causes strange problems
/* This causes strange problems on some systems
fclose(yyin);
yyin = 0;
*/
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment