Permalink
Browse files

Merge remote-tracking branch 'upstream/master'

  • Loading branch information...
2 parents c8a74d6 + 43935bb commit c7b90289aecb1ba9141ebcc9432102b61cd1e144 @erikd committed May 9, 2012
Showing with 4 additions and 1 deletion.
  1. +1 −1 runtests.hs
  2. +3 −0 src/Language/JavaScript/Parser/Parser.hs
View
@@ -294,7 +294,7 @@ testSuite = testGroup "Parser"
, testCase "unicode4" (testProg "x=\"àáâãäå\";y='\3012a\0068'" "Right (JSSourceElementsTop [JSExpression [JSIdentifier \"x\",JSOperator JSLiteral \"=\",JSStringLiteral '\"' \"\\224\\225\\226\\227\\228\\229\"],JSLiteral \";\",JSExpression [JSIdentifier \"y\",JSOperator JSLiteral \"=\",JSStringLiteral '\\'' \"\\3012aD\"],JSLiteral \"\"])")
- , testCase "unicode5" (testFile "./test/Unicode.js" "JSSourceElementsTop [JSExpression [JSIdentifier \"\\224\\225\\226\\227\\228\\229\",JSOperator JSLiteral \"=\",JSDecimal \"1\"],JSLiteral \";\",JSLiteral \"\"]")
+ , testCase "unicode5f" (testFile "./test/Unicode.js" "JSSourceElementsTop [JSExpression [JSIdentifier \"\\224\\225\\226\\227\\228\\229\",JSOperator JSLiteral \"=\",JSDecimal \"1\"],JSLiteral \";\",JSLiteral \"\"]")
, testCase "bug2.a" (testProg "function() {\nz = function /*z*/(o) {\nreturn r;\n};}" "Right (JSSourceElementsTop [JSExpression [JSFunctionExpression [] [] (JSBlock ([JSExpression [JSIdentifier \"z\",JSOperator JSLiteral \"=\",JSFunctionExpression [] [JSIdentifier \"o\"] (JSBlock ([JSReturn [JSExpression [JSIdentifier \"r\"]] JSLiteral \";\"]))],JSLiteral \";\"]))],JSLiteral \"\"])")
@@ -34,6 +34,9 @@ readJs input = do
Left msg -> error (show msg)
Right p -> p
+-- | Parse the given file.
+-- For UTF-8 support, make sure your locale is set such that
+-- "System.IO.localeEncoding" returns "utf8"
parseFile :: FilePath -> IO AST.JSNode
parseFile filename =
do

0 comments on commit c7b9028

Please sign in to comment.