Changeset 13048

Show
Ignore:
Timestamp:
09/05/06 21:56:10 (2 years ago)
Author:
Sage
Message:

The translator will now accept multiple modifiers after one -, so -VR and similar are valid. In addition, -O is now used for heavy object-oriented translation (but -Oo is still useable.
In addition, I found a stupid little error in ASTParser that I fixed (just some bad indentation, not sure how that got there).

Location:
misc/pX/Common/P5_to_P6_Translation
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • misc/pX/Common/P5_to_P6_Translation/ASTParser.hs

    r12536 r13048  
    186186printTree outFile (AbstractNode atype []) options      = if (and [(atype=="UnknownAbs"),('u' `elem` options)]) then do{ hPutStr outFile "UnknownAbs"; putStrLn "UNKNOWN: UnknownAbs"; hPutStr outFile ""} else (hPutStr outFile "") 
    187187printTree outFile (AbstractNode atype kids) options    = if (and [(atype=="UnknownAbs"),('u' `elem` options)]) then do{ hPutStr outFile "UnknownAbs"; putStrLn "UNKNOWN: UnknownAbs"; printTree outFile (head kids) options; printTree outFile (AbstractNode "P5AST" (tail kids)) options} else do{ printTree outFile (head kids) options; printTree outFile (AbstractNode "P5AST" (tail kids)) options} 
    188 printTree outFile (Heredoc doc start end kids) options = do printTree outFile start options 
    189     hPutStr outFile ";\n" 
    190     printTree outFile (AbstractNode "P5AST" kids) options 
    191     printTree outFile end options 
     188printTree outFile (Heredoc doc start end kids) options = do{ printTree outFile start options; 
     189    hPutStr outFile "\n"; 
     190    printTree outFile (AbstractNode "P5AST" kids) options; 
     191    printTree outFile end options} 
    192192 
  • misc/pX/Common/P5_to_P6_Translation/ASTTranslate-sage.hs

    r12541 r13048  
    884884getModifiers :: [String] -> String 
    885885getModifiers []   = " " 
    886 getModifiers args = case (head args) of 
    887     "-Oo"    ->  ('o':(getModifiers (drop 1 args))) 
    888     "-V"     ->  ('v':(getModifiers (drop 1 args))) 
    889     "-U"     ->  ('u':(getModifiers (drop 1 args))) 
    890     "-R"     ->  ('r':(getModifiers (drop 1 args))) 
    891     "-N"     ->  ('n':(getModifiers (drop 1 args))) 
    892     "-S"     ->  ('s':(getModifiers (drop 1 args))) 
    893     _        ->  (' ':(getModifiers (drop 1 args))) 
     886getModifiers args = if ((head (head args))=='-') then (multiMods (head args))++(getModifiers (drop 1 args)) else (getModifiers (drop 1 args)) 
     887 
     888multiMods :: String -> String 
     889multiMods [] = " " 
     890multiMods mods = case (head mods) of 
     891    'O'    -> 'o':(multiMods (tail mods)) 
     892    'U'    -> 'u':(multiMods (tail mods)) 
     893    'V'    -> 'v':(multiMods (tail mods)) 
     894    'S'    -> 's':(multiMods (tail mods)) 
     895    'R'    -> 'r':(multiMods (tail mods)) 
     896    'N'    -> 'n':(multiMods (tail mods)) 
    894897 
    895898