Permalink
Browse files

Accept scilab variable names.

  • Loading branch information...
1 parent 6ece0ed commit cc2e49dd31d9b791275d8204c596de1102fb9f45 @marcotmarcot committed Oct 11, 2012
Showing with 16 additions and 2 deletions.
  1. +16 −2 Scilab/Lexer.hs
View
@@ -16,7 +16,6 @@ import
many1,
digit,
letter,
- alphaNum,
(<|>),
many,
noneOf,
@@ -119,9 +118,24 @@ token
[many1 digit,
option "" $ try $ (: []) <$> char '.',
option "" $ try $ many1 digit])
- <|> try (TId <$> T.pack <$> liftM2 (:) letter (many alphaNum))
+ <|> try (TId <$> T.pack <$> liftM2 (:) fid rid)
<|> try
(oneOf "'\"" >> TStr <$> T.pack <$> many (noneOf "'\"") <* char '"'))
+fid :: Parser Char
+fid = cid <|> char '%'
+
+rid :: Parser String
+rid = many $ cid <|> digit
+
+cid :: Parser Char
+cid
+ = letter
+ <|> char '_'
+ <|> char '#'
+ <|> char '!'
+ <|> char '$'
+ <|> char '?'
+
whites :: Parser ()
whites = void $ many $ oneOf " \t"

0 comments on commit cc2e49d

Please sign in to comment.