Add bootstrap/n.sh test script
authorNick Downing <nick@ndcode.org>
Sat, 19 Jan 2019 11:17:38 +0000 (22:17 +1100)
committerNick Downing <nick@ndcode.org>
Sat, 19 Jan 2019 11:19:24 +0000 (22:19 +1100)
.gitignore
bootstrap/n.sh [new file with mode: 0755]
bootstrap/state.py

index fa388bb..1f8d7f0 100644 (file)
@@ -1,6 +1,7 @@
 __pycache__
 bootstrap/*.xml
 bootstrap/lex_yy.py
+bootstrap/out
 bootstrap/y_tab.py
 lex-yacc-examples/*.c
 lex-yacc-examples/*.h
diff --git a/bootstrap/n.sh b/bootstrap/n.sh
new file mode 100755 (executable)
index 0000000..3804e33
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+if ! test -d out
+then
+  mkdir out
+  ../../bootstrap_flex.git/src/flex -o /dev/null ../tests/cal.l 2>out/cal.l.xml.ok
+  ../../bootstrap_flex.git/src/flex -o /dev/null ../../bootstrap_flex.git/src/scan.l 2>out/scan.l.xml.ok
+  ../../bootstrap_flex.git/src/flex ../../bootstrap_bison.git/src/scan-code.l 2>out/scan-code.l.xml.ok
+  rm lex.yy.c
+  ../../bootstrap_flex.git/src/flex ../../bootstrap_bison.git/src/scan-gram.l 2>out/scan-gram.l.xml.ok
+  rm lex.yy.c
+  ../../bootstrap_flex.git/src/flex ../../bootstrap_bison.git/src/scan-skel.l 2>out/scan-skel.l.xml.ok
+  rm lex.yy.c
+fi
+./markup.py <../tests/cal.l >out/cal.l.xml
+diff --unified out/cal.l.xml.ok out/cal.l.xml
+./markup.py <../../bootstrap_flex.git/src/scan.l >out/scan.l.xml
+diff --unified out/scan.l.xml.ok out/scan.l.xml
+./markup.py <../../bootstrap_bison.git/src/scan-code.l >out/scan-code.l.xml
+diff --unified out/scan-code.l.xml.ok out/scan-code.l.xml
+./markup.py <../../bootstrap_bison.git/src/scan-gram.l >out/scan-gram.l.xml
+diff --unified out/scan-gram.l.xml.ok out/scan-gram.l.xml
+./markup.py <../../bootstrap_bison.git/src/scan-skel.l >out/scan-skel.l.xml
+diff --unified out/scan-skel.l.xml.ok out/scan-skel.l.xml
index a7f05d6..5608fca 100644 (file)
@@ -47,7 +47,7 @@ def myesc(str):
       j = min(5, len(str))
       while i < j and str[i] in '01234567':
         i += 1
-      result = int(str[2:i], 8)
+      result = int(str[1:i], 8)
     elif str[1] == 'x':
       i = 2
       j = min(4, len(str))