Changeset 21952 for src/perl6

Show
Ignore:
Timestamp:
08/19/08 22:07:25 (3 months ago)
Author:
lwall
Message:

[STD] allow use of ::?CLASS in declaration
[STD] reverse use of ident/identifier to make ident the shorter one

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/perl6/STD.pm

    r21951 r21952  
    445445} 
    446446 
    447 token identifier { 
     447token ident { 
    448448    <.alpha> \w* 
    449449} 
     
    453453} 
    454454 
    455 token ident { 
    456     <.identifier> [ <.apostrophe> <.identifier> ]* 
     455token identifier { 
     456    <.ident> [ <.apostrophe> <.ident> ]* 
    457457} 
    458458 
     
    462462    ^^ '=' <.unsp>? 
    463463    [ 
    464     | 'begin' \h+ <ident> :: .*? 
    465       "\n=" <.unsp>? 'end' \h+ $<ident> » \N*         {*}         #= tagged 
     464    | 'begin' \h+ <identifier> :: .*? 
     465      "\n=" <.unsp>? 'end' \h+ $<identifier> » \N*         {*}         #= tagged 
    466466    | 'begin' » :: \h* \n .*? 
    467467      "\n=" <.unsp>? 'end' » \N*                      {*}         #= anon 
     
    564564 
    565565token label { 
    566     <ident> ':' <?before \s> <.ws> 
    567  
    568     [ <?{ $¢.is_type($<ident>.text) }> 
     566    <identifier> ':' <?before \s> <.ws> 
     567 
     568    [ <?{ $¢.is_type($<identifier>.text) }> 
    569569      <.panic("You tried to use an existing typename as a label")> 
    570 #      <suppose("You tried to use an existing name $/{'ident'} as a label")> 
     570#      <suppose("You tried to use an existing name $/{'identifier'} as a label")> 
    571571    ]? 
    572572 
    573573    # add label as a pseudo type 
    574     # {{ eval 'COMPILING::{"::$<ident>"} = Label.new($<ident>)' }}  # XXX need statement ref too? 
     574    # {{ eval 'COMPILING::{"::$<identifier>"} = Label.new($<identifier>)' }}  # XXX need statement ref too? 
    575575 
    576576} 
     
    839839 
    840840token fatarrow { 
    841     <key=ident> \h* '=>' :: <.ws> <val=EXPR(item %item_assignment)> 
     841    <key=identifier> \h* '=>' :: <.ws> <val=EXPR(item %item_assignment)> 
    842842} 
    843843 
     
    848848    ':' 
    849849    [ 
    850     | '!' <ident> 
    851         { $key = $<ident>.text; $value = 0; } 
     850    | '!' <identifier> 
     851        { $key = $<identifier>.text; $value = 0; } 
    852852        {*}                                                     #= false 
    853     | <ident> 
    854         { $key = $<ident>.text; } 
     853    | <identifier> 
     854        { $key = $<identifier>.text; } 
    855855        [ 
    856856        || <.unsp>? '.'? <postcircumfix> { $value = $<postcircumfix>; } 
     
    875875    ':' 
    876876    [ 
    877     | '!' <ident> 
    878         { $key = $<ident>.text; $value = 0; } 
     877    | '!' <identifier> 
     878        { $key = $<identifier>.text; $value = 0; } 
    879879        {*}                                                     #= false 
    880     | <ident> 
    881         { $key = $<ident>.text; } 
     880    | <identifier> 
     881        { $key = $<identifier>.text; } 
    882882        [ 
    883883        || <.unsp>? '.'? <?before '('> <postcircumfix> { $value = $<postcircumfix>; } 
     
    15501550token name { 
    15511551    [ 
    1552     | <ident> <morename>* 
     1552    | <identifier> <morename>* 
    15531553    | <morename>+ 
    15541554    ]? 
     
    15601560    <?before '(' | <alpha> > 
    15611561    [ 
    1562     | <ident> 
     1562    | <identifier> 
    15631563    | '(' :: <in: ')', 'EXPR', 'indirect name'> 
    15641564    ] 
     
    16021602 
    16031603token typename { 
    1604     <longname> 
    1605     <?{ 
     1604    [ 
     1605    | '::?'<identifier>                 # parse ::?CLASS as special case 
     1606    | <longname> 
     1607      <?{ 
    16061608        my $longname = $<longname>.text; 
    16071609        substr($longname, 0, 2) eq '::' or $¢.is_type($longname) 
    1608     }> 
     1610      }> 
     1611    ] 
    16091612    # parametric type? 
    16101613    <.unsp>? [ <?before '['> <postcircumfix> ]? 
     
    24262429} 
    24272430token trait_auxiliary:will { 
    2428     <sym> <.ws> <ident> <.ws> <block> 
     2431    <sym> <.ws> <identifier> <.ws> <block> 
    24292432} 
    24302433 
     
    24982501    ':' 
    24992502    [ 
    2500     | <name=ident> '(' <.ws> 
     2503    | <name=identifier> '(' <.ws> 
    25012504        [ <named_param> | <param_var> <.ws> ] 
    25022505        [ ')' || <.panic: "Unable to parse named parameter; couldn't find right parenthesis"> ] 
     
    25092512    [ 
    25102513        # Is it a longname declaration? 
    2511     || <?{ $<sigil>.text eq '&' }> <?ident> :: 
    2512         <ident=sublongname> 
     2514    || <?{ $<sigil>.text eq '&' }> <?identifier> :: 
     2515        <identifier=sublongname> 
    25132516 
    25142517    ||  # Is it a shaped array or hash declaration? 
    25152518        <?{ $<sigil>.text eq '@' || $<sigil>.text eq '%' }> 
    2516         <ident>? 
     2519        <identifier>? 
    25172520        <?before <[ \< \( \[ \{ ]> > 
    25182521        <postcircumfix> 
    25192522 
    25202523        # ordinary parameter name 
    2521     || <ident> 
     2524    || <identifier> 
    25222525 
    25232526        # bare sigil? 
     
    26092612 
    26102613token term:sym<::?IDENT> ( --> Term) { 
    2611     $<sym> = [ '::?' <ident> ] » 
     2614    $<sym> = [ '::?' <identifier> ] » 
    26122615} 
    26132616 
     
    30683071#     { <typename> <?spacey> <arglist> { $<sym> = $<typename>.item; } } 
    30693072 
    3070 # force ident(), ident.(), etc. to be a function call always 
    3071 token term:ident ( --> Term ) 
     3073# force identifier(), identifier.(), etc. to be a function call always 
     3074token term:identifier ( --> Term ) 
    30723075{ 
    30733076    :my $i; 
    3074     $i = <ident> <args( $¢.is_type($i.text) )> 
     3077    $i = <identifier> <args( $¢.is_type($i.text) )> 
    30753078} 
    30763079 
     
    30973100 
    30983101# names containing :: may or may not be function calls 
    3099 # bare ident without parens also handled here if no other rule parses it 
     3102# bare identifier without parens also handled here if no other rule parses it 
    31003103token term:name ( --> Term) 
    31013104{ 
     
    36723675    } 
    36733676 
    3674     token assertion:ident { <ident> [               # is qq right here? 
     3677    token assertion:identifier { <identifier> [               # is qq right here? 
    36753678                                    | <?before '>' > 
    36763679                                    | <.ws> <nibbler> 
     
    37383741 
    37393742    token mod_internal:adv { 
    3740         <?before ':' <ident> > [ :lang($¢.cursor_fresh($+LANG)) <quotepair> ] { $/<sym> := «: $<quotepair><key>» } 
     3743        <?before ':' <identifier> > [ :lang($¢.cursor_fresh($+LANG)) <quotepair> ] { $/<sym> := «: $<quotepair><key>» } 
    37413744    } 
    37423745