Shifting standard unit definitions
This commit is contained in:
@@ -37,68 +37,76 @@ ID [a-z][a-z0-9]*
|
||||
|
||||
[-+()=/*^] { return *yytext; }
|
||||
|
||||
"nm" yylval = Quantity(1.0e-6 ,Unit(1)); return UNIT; // nano meter
|
||||
"ym" yylval = Quantity(1.0e-3 ,Unit(1)); return UNIT; // micro meter
|
||||
"mm" yylval = Quantity(1.0 ,Unit(1)); return UNIT; // milli meter
|
||||
"cm" yylval = Quantity(10.0 ,Unit(1)); return UNIT; // centi meter
|
||||
"dm" yylval = Quantity(100.0 ,Unit(1)); return UNIT; // deci meter
|
||||
"m" yylval = Quantity(1.0e3 ,Unit(1)); return UNIT; // meter
|
||||
"km" yylval = Quantity(1.0e6 ,Unit(1)); return UNIT; // kilo meter
|
||||
"l" yylval = Quantity(1000000.0 ,Unit(3)); return UNIT; // Liter dm^3
|
||||
"nm" yylval = Quantity::NanoMeter; return UNIT; // nano meter
|
||||
"ym" yylval = Quantity::MicroMeter; return UNIT; // micro meter
|
||||
"mm" yylval = Quantity::MilliMeter; return UNIT; // milli meter (internal standard length)
|
||||
"cm" yylval = Quantity::CentiMeter; return UNIT; // centi meter
|
||||
"dm" yylval = Quantity::DeciMeter; return UNIT; // deci meter
|
||||
"m" yylval = Quantity::Meter; return UNIT; // meter
|
||||
"km" yylval = Quantity::KiloMeter; return UNIT; // kilo meter
|
||||
|
||||
"yg" yylval = Quantity(1.0e-9 ,Unit(0,1)); return UNIT; // milli gram
|
||||
"mg" yylval = Quantity(1.0e-6 ,Unit(0,1)); return UNIT; // milli gram
|
||||
"g" yylval = Quantity(1.0e-3 ,Unit(0,1)); return UNIT; // gram
|
||||
"kg" yylval = Quantity(1.0 ,Unit(0,1)); return UNIT; // kilo gram (internal standard for mass)
|
||||
"t" yylval = Quantity(1000.0 ,Unit(0,1)); return UNIT; // ton
|
||||
|
||||
"s" yylval = Quantity(1.0 ,Unit(0,0,1)); return UNIT; // second (internal standard time)
|
||||
"min" yylval = Quantity(60.0 ,Unit(0,0,1)); return UNIT; // minute
|
||||
"h" yylval = Quantity(3600.0 ,Unit(0,0,1)); return UNIT; // hour
|
||||
|
||||
"A" yylval = Quantity(1.0 ,Unit(0,0,0,1)); return UNIT; // Ampere (internal standard electric current)
|
||||
"mA" yylval = Quantity(0.001 ,Unit(0,0,0,1)); return UNIT; // milli Ampere
|
||||
"kA" yylval = Quantity(1000.0 ,Unit(0,0,0,1)); return UNIT; // kilo Ampere
|
||||
"MA" yylval = Quantity(1.0e6 ,Unit(0,0,0,1)); return UNIT; // Mega Ampere
|
||||
|
||||
"K" yylval = Quantity(1.0 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin (internal standard thermodynamic temperature)
|
||||
"mK" yylval = Quantity(0.001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
"yK" yylval = Quantity(0.000001 ,Unit(0,0,0,0,1)); return UNIT; // Kelvin
|
||||
|
||||
"mol" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,1)); return UNIT; // Mole (internal standard amount of substance)
|
||||
|
||||
"cd" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,1)); return UNIT; // Candela (internal standard luminous intensity)
|
||||
|
||||
"deg" yylval = Quantity(1.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // degree (internal standard angle)
|
||||
"rad" yylval = Quantity(180/M_PI ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // radian
|
||||
"gon" yylval = Quantity(360.0/400.0 ,Unit(0,0,0,0,0,0,0,1)); return UNIT; // gon
|
||||
|
||||
"in" yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
"\"" yylval = Quantity(25.4 ,Unit(1)); return UNIT; // inch
|
||||
"fo" yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
"'" yylval = Quantity(304.8 ,Unit(1)); return UNIT; // foot
|
||||
"th" yylval = Quantity(0.0254 ,Unit(1)); return UNIT; // thou
|
||||
"yr" yylval = Quantity(914.4 ,Unit(1)); return UNIT; // yard
|
||||
|
||||
|
||||
"lb" yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // pound
|
||||
"oz" yylval = Quantity(0.45359237 ,Unit(0,1)); return UNIT; // ounce
|
||||
"st" yylval = Quantity(6.35029318 ,Unit(0,1)); return UNIT; // Stone
|
||||
"cwt" yylval = Quantity(50.80234544 ,Unit(0,1)); return UNIT; // hundredweights
|
||||
|
||||
"N" yylval = Quantity(1000.0 ,Unit(1,1,-2)); return UNIT; // Newton (kg*m/s^2)
|
||||
"l" yylval = Quantity::Liter; return UNIT; // Liter dm^3
|
||||
|
||||
"Pa" yylval = Quantity(0.001 ,Unit(-1,1,-2)); return UNIT; // Pascal (kg/m*s^2)
|
||||
"psi" yylval = Quantity(0.145038 ,Unit(-1,1,-2)); return UNIT; // pounds/in^2
|
||||
|
||||
"W" yylval = Quantity(1e+6 ,Unit(2,1,-3)); return UNIT; // Watt (kg*m^2/s^3)
|
||||
"VA" yylval = Quantity(1e+6 ,Unit(2,1,-3)); return UNIT; // VoltAmpere (kg*m^2/s^3)
|
||||
|
||||
"J" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"Nm" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"VAs" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"CV" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"Ws" yylval = Quantity(1e+6 ,Unit(2,1,-2)); return UNIT; // Joule (kg*m^2/s^2)
|
||||
"yg" yylval = Quantity::MicroGram; return UNIT; // micro gram
|
||||
"mg" yylval = Quantity::MilliGram; return UNIT; // milli gram
|
||||
"g" yylval = Quantity::Gram; return UNIT; // gram
|
||||
"kg" yylval = Quantity::KiloGram; return UNIT; // kilo gram (internal standard for mass)
|
||||
"t" yylval = Quantity::Ton; return UNIT; // ton
|
||||
|
||||
"s" yylval = Quantity::Second; return UNIT; // second (internal standard time)
|
||||
"min" yylval = Quantity::Minut; return UNIT; // minute
|
||||
"h" yylval = Quantity::Hour; return UNIT; // hour
|
||||
|
||||
"A" yylval = Quantity::Ampere; return UNIT; // Ampere (internal standard electric current)
|
||||
"mA" yylval = Quantity::MilliAmpere; return UNIT; // milli Ampere
|
||||
"kA" yylval = Quantity::KiloAmpere; return UNIT; // kilo Ampere
|
||||
"MA" yylval = Quantity::MegaAmpere; return UNIT; // Mega Ampere
|
||||
|
||||
"K" yylval = Quantity::Kelvin; return UNIT; // Kelvin (internal standard thermodynamic temperature)
|
||||
"mK" yylval = Quantity::MilliKelvin; return UNIT; // Kelvin
|
||||
"yK" yylval = Quantity::MicroKelvin; return UNIT; // Kelvin
|
||||
|
||||
"mol" yylval = Quantity::Mole; return UNIT; // Mole (internal standard amount of substance)
|
||||
|
||||
"cd" yylval = Quantity::Candela; return UNIT; // Candela (internal standard luminous intensity)
|
||||
|
||||
"in" yylval = Quantity::Inch; return UNIT; // inch
|
||||
"\"" yylval = Quantity::Inch; return UNIT; // inch
|
||||
"fo" yylval = Quantity::Foot; return UNIT; // foot
|
||||
"'" yylval = Quantity::Foot; return UNIT; // foot
|
||||
"th" yylval = Quantity::Thou; return UNIT; // thou
|
||||
"yr" yylval = Quantity::Yard; return UNIT; // yard
|
||||
|
||||
|
||||
"lb" yylval = Quantity::Pound; return UNIT; // pound
|
||||
"oz" yylval = Quantity::Ounce; return UNIT; // ounce
|
||||
"st" yylval = Quantity::Stone; return UNIT; // Stone
|
||||
"cwt" yylval = Quantity::Hundredweights; return UNIT; // hundredweights
|
||||
|
||||
"N" yylval = Quantity::Newton; return UNIT; // Newton (kg*m/s^2)
|
||||
"kN" yylval = Quantity::KiloNewton; return UNIT; // Newton
|
||||
"MN" yylval = Quantity::MegaNewton; return UNIT; // Newton
|
||||
"mN" yylval = Quantity::MilliNewton; return UNIT; // Newton
|
||||
|
||||
"Pa" yylval = Quantity::Pascal; return UNIT; // Pascal (kg/m*s^2 or N/m^2)
|
||||
"kPa" yylval = Quantity::KiloPascal; return UNIT; // Pascal
|
||||
"MPa" yylval = Quantity::MegaPascal; return UNIT; // Pascal
|
||||
"GPa" yylval = Quantity::GigaPascal; return UNIT; // Pascal
|
||||
|
||||
"psi" yylval = Quantity::PSI; return UNIT; // pounds/in^2
|
||||
|
||||
"W" yylval = Quantity::Watt; return UNIT; // Watt (kg*m^2/s^3)
|
||||
"VA" yylval = Quantity::VoltAmpere; return UNIT; // VoltAmpere (kg*m^2/s^3)
|
||||
|
||||
"J" yylval = Quantity::Joul; return UNIT; // Joule (kg*m^2/s^2)
|
||||
"Nm" yylval = Quantity::NewtonMeter; return UNIT; // Joule (kg*m^2/s^2)
|
||||
"VAs" yylval = Quantity::VoltAmpereSecond; return UNIT; // Joule (kg*m^2/s^2)
|
||||
"CV" yylval = Quantity::WattSecond; return UNIT; // Joule (kg*m^2/s^2)
|
||||
"Ws" yylval = Quantity::WattSecond; return UNIT; // Joule (kg*m^2/s^2)
|
||||
|
||||
"deg" yylval = Quantity::Degree; return UNIT; // degree (internal standard angle)
|
||||
"rad" yylval = Quantity::Radian; return UNIT; // radian
|
||||
"gon" yylval = Quantity::Gon; return UNIT; // gon
|
||||
|
||||
{DIGIT}+["."","]{DIGIT}*[eE][-+]?[0-9]+ {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
{DIGIT}+["."","]{DIGIT}* {for(char* c=yytext;*c!='\0';c++)if(*c==',')*c='.'; yylval = atof( yytext ); return NUM;}
|
||||
|
||||
Reference in New Issue
Block a user