Changeset 10248 for src/Pugs/Lexer.hs

Show
Ignore:
Timestamp:
05/09/06 17:53:22 (3 years ago)
Author:
audreyt
svk:copy_cache_prev:
13387
Message:

* Pugs.Lexer: ruleWs -- proper dynamic <ws> support for

cases where we can't infer what <ws> means statically
from rules input.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • src/Pugs/Lexer.hs

    r10178 r10248  
    2121    rule, verbatimRule, literalRule, 
    2222    tryRule, tryVerbatimRule, 
    23     tryChoice, ruleComma, 
     23    tryChoice, ruleComma, ruleWs, 
    2424 
    2525    ruleScope, ruleTrait, ruleTraitName, ruleBareTrait, ruleType, 
     
    131131    return contents 
    132132 
     133-- The <ws> rule. 
     134ruleWs :: RuleParser () 
     135ruleWs = do 
     136    prev <- getPrevCharClass 
     137    case prev of 
     138        SpaceClass -> whiteSpace 
     139        _  -> do 
     140            curr <- getCurrCharClass 
     141            if prev == curr then mandatoryWhiteSpace else case curr of 
     142                SpaceClass  -> whiteSpace 
     143                _           -> return () 
     144 
    133145{-| 
    134146Match one or more identifiers, separated internally by the given delimiter.