In an effort to support utf8-encoded grammar files, I tried the following:

$ svn diff compilers/pge/rulec.pir
Index: compilers/pge/rulec.pir
===================================================================
--- compilers/pge/rulec.pir     (revision 11998)
+++ compilers/pge/rulec.pir     (working copy)
@@ -128,6 +128,7 @@
     .local pmc infh
     infh = open infile, "<"
+    push infh, 'utf8' # assume utf8, should degrade nicely for ASCII
     unless infh goto ERR_NO_INFILE
     .local string source


Which lets "make test" for parrot succeed just fine…

This generates a build error with punie, however:

../../parrot ../../compilers/pge/rulec.pir --output=lib/ punie_grammar_gen.pir lib/punie.g
p6rule parse error: Term expected at offset 86, found '{'
current instr.: 'PGE::P6Rule :: parse_error' pc 8912 (compilers/pge/ PGE/P6Rule.pir:591) called from Sub 'PGE::P6Rule :: parse_ws_lit' pc 7710 (compilers/pge/ PGE/P6Rule.pir:215) called from Sub 'PGE::OPTable :: parse' pc 1523 (compilers/pge/PGE/ OPTable.pir:431) called from Sub 'PGE::Rule :: p6rule' pc 8931 (compilers/pge/PGE/ P6Rule.pir:601)
called from Sub 'PGE :: _grammar_rule_corou' pc 1796 (EVAL_1:684)
called from Sub 'PGE :: _grammar_rule' pc 18 (EVAL_1:9)
called from Sub 'PGE :: compile_rules' pc 67 (/Users/wcoleda/research/ parrot/runtime/parrot/library/PGE/Util.pir:93)
called from Sub 'main' pc 138 (../../compilers/pge/rulec.pir:140)

Clues welcome.


Reply via email to