javar/jdk8-analysis/src/launcher/version_comp.c
/*
 *      Return true if this is a valid simple-element (as defined in JSR 56).
 *
 *      The official grammar for a simple-element is:
 *
 *              simple-element  ::= version-id | version-id modifier
 *              modifier        ::= '+' | '*'
 *              version-id      ::= string ( separator  string )*
 *              string          ::= char ( char )*
 *              char            ::= Any ASCII character except a space, an
 *                                  ampersand, a separator or a modifier
 *              separator       ::= '.' | '-' | '_'
 *
 *      However, for efficiency, it is time to abandon the top down parser
 *      implementation.  After deleting the potential trailing modifier, we
 *      are left with a version-id.
 *
 *      Note that a valid version-id has three simple properties:
 *
 *      1) Doesn't contain a space, an ampersand or a modifier.
 *
 *      2) Doesn't begin or end with a separator.
 *
 *      3) Doesn't contain two adjacent separators.
 *
 *      Any other line noise constitutes a valid version-id.
 */
Return true if this is a valid simple-element (as defined in JSR 56).
The official grammar for a simple-element is.



However, for efficiency, it is time to abandon the top down parser
implementation.  After deleting the potential trailing modifier, we
are left with a version-id.

Note that a valid version-id has three simple properties.

1) Doesn't contain a space, an ampersand or a modifier.

2) Doesn't begin or end with a separator.

3) Doesn't contain two adjacent separators.

Any other line noise constitutes a valid version-id.
Return true if this is a valid simple - element ( as defined in JSR 56 ) . The official grammar for a simple - element is . However for efficiency it is time to abandon the top down parser implementation . After deleting the potential trailing modifier we are left with a version - id . Note that a valid version - id has three simple properties . 1 ) Doesn ' t contain a space an ampersand or a modifier . 2 ) Doesn ' t begin or end with a separator . 3 ) Doesn ' t contain two adjacent separators . Any other line noise constitutes a valid version - id .
static int
valid_simple_element(char *simple_element)
{
    char        *last;
    size_t      len;
    if ((simple_element == NULL) || ((len = JLI_StrLen(simple_element)) == 0))
        return (0);
    last = simple_element + len - 1;
    if (*last == '*' || *last == '+') {
        if (--len == 0)
            return (0);
        *last-- = '\0';
    }
    if (JLI_StrPBrk(simple_element, " &+*") != NULL)    
        return (0);
    if ((JLI_StrChr(".-_", *simple_element) != NULL) || 
      (JLI_StrChr(".-_", *last) != NULL))
        return (0);
    for (; simple_element != last; simple_element++)    
        if ((JLI_StrChr(".-_", *simple_element) != NULL) &&
          (JLI_StrChr(".-_", *(simple_element + 1)) != NULL))
            return (0);
    return (1);
}
static int valid_simple_element ( char * simple_element ) { char * last ; size_t len ; if ( ( simple_element == NULL ) || ( ( len = JLI_StrLen ( simple_element ) ) == 0 ) ) return ( 0 ) ; last = simple_element + len - 1 ; if ( * last == ' ' || * last == ' ' ) { if ( -- len == 0 ) return ( 0 ) ; * last -- = ' \0 ' ; } if ( JLI_StrPBrk ( simple_element , " " ) != NULL ) return ( 0 ) ; if ( ( JLI_StrChr ( " " , * simple_element ) != NULL ) || ( JLI_StrChr ( " " , * last ) != NULL ) ) return ( 0 ) ; for ( ; simple_element != last ; simple_element ++ ) if ( ( JLI_StrChr ( " " , * simple_element ) != NULL ) && ( JLI_StrChr ( " " , * ( simple_element + 1 ) ) != NULL ) ) return ( 0 ) ; return ( 1 ) ; }
Return true if this is a valid simple-element (as defined in JSR 56).
Return true if this is a valid simple - element ( as defined in JSR 56 ) .
/* Property #1 */ /* Property #2 */ /* Property #3 */