UML 1.4 NO IDEA Avatar
  1. OMG Issue

UML14 — OCL: Numeric constants missing

  • Key: UML14-974
  • Legacy Issue Number: 3145
  • Status: closed  
  • Source: OpenModeling ( Jos Warmer)
  • Summary:

    The OCL chapter of the UML reference insists that not only there
    is a data type Real, but one can also write constants of this type.
    However, the OCL grammar does not allow for floating-point
    constants.

    To correct that, the rule for numbers:

    number := ["0"-"9"] (["0"-"9"])*

    could be rewritten as:

    number := ["0"-"9"] (["0"-"9"])*
    ( "." ["0"-"9"] (["0"-"9"])* )?
    ( ("e" | "E") ( "+" | "-" )? ["0"-"9"] (["0"-"9"])* )?

    to allow all traditional forms of Real constants, both with decimal
    point and with exponent (and both).

    The one mandatory digit after the decimal point is there on purpose,
    to make sure that in an OCL string like

    1..10

    (which is perfectly legal inside the OCL collection literal) the
    leftmost sub-string '1.' will not be incorrectly recognized as a real
    constant. This little trick allows writing lexical parser for the OCL
    that does not need more than one-character look-ahead.

    Proposed resolution:

    Agreed.
    ______________

  • Reported: UML 1.2 — Fri, 17 Dec 1999 05:00 GMT
  • Disposition: Resolved — UML 1.3
  • Disposition Summary:

    No Data Available

  • Updated: Fri, 6 Mar 2015 21:37 GMT