/* (c) https://github.com/MontiCore/monticore */ package de.monticore.siunit; /* This is a MontiCore stable grammar. * Adaptations -- if any -- are conservative. */ /** * This grammar defines SI unit literals * based on all the available SI units such as * '3 m', '2.5 km', '1 km^2' or '3.54l m*deg/(h^2*mg)' * * The definitions are fully compliant to the definitions given in * International Bureau of Weights and Measures (20 May 2019), * SI Brochure: The International System of Units (SI)(9th ed.) * * Caution: * Java long and float unfortunately conflict with SI Units "F" and "L". * We therefore decided: * If the number is followed by L (or F respectively), the literal will * be parsed as BasicLongLiteral "30L" or BasicFloatLiteral "30.2F" * Only if a space is inbetween, it becomes a Liter Literal "30 L" * or Farad Literal "30.2 F". * Accordingly "30Lkg" is not parsable, but "30L kg" and "30 L*kg" are. * * The grammar extends the MontiCore common literals, because it uses * natural numbers e.g. as exponent. */ component grammar SIUnitLiterals extends de.monticore.siunit.SIUnits, de.monticore.literals.MCCommonLiterals { // The unsigned SI unit literals SIUnitLiteral implements Literal <10> = NumericLiteral SIUnit ; // The signed SI unit literals SignedSIUnitLiteral implements SignedLiteral <10> = SignedNumericLiteral SIUnit ; }