From 69df0b216fc51889aee3323a5505b7d49ffc5b4d Mon Sep 17 00:00:00 2001 From: Andy C Date: Tue, 14 Jan 2025 11:56:31 -0500 Subject: [PATCH] [refactor] Move files out of lazylex/ Preparing for data_lang/htm8.py. Add htm8.asdl. Not used yet. --- build/py.sh | 1 + data_lang/htm8.asdl | 24 +++++++++++++++++++ .../testdata/hello.htm8 | 0 lazylex/README.md => doc/lazylex.md | 0 doctools/oils_doc_test.py | 4 ++-- lazylex/html_test.py | 2 +- 6 files changed, 28 insertions(+), 3 deletions(-) create mode 100644 data_lang/htm8.asdl rename lazylex/testdata.html => data_lang/testdata/hello.htm8 (100%) rename lazylex/README.md => doc/lazylex.md (100%) diff --git a/build/py.sh b/build/py.sh index 625a376965..9a1e91170d 100755 --- a/build/py.sh +++ b/build/py.sh @@ -139,6 +139,7 @@ py-codegen() { # depends on syntax.asdl gen-asdl-py 'core/runtime.asdl' gen-asdl-py 'core/value.asdl' + gen-asdl-py 'data_lang/htm8.asdl' gen-asdl-py 'data_lang/nil8.asdl' gen-asdl-py 'display/pretty.asdl' gen-asdl-py 'mycpp/mycpp.asdl' diff --git a/data_lang/htm8.asdl b/data_lang/htm8.asdl new file mode 100644 index 0000000000..70bdbeae08 --- /dev/null +++ b/data_lang/htm8.asdl @@ -0,0 +1,24 @@ + +module htm8 +{ + + h8_id = + Decl + + # CommentBegin, ProcessingBegin, CDataBegin are "pseudo-tokens", not visible + | Comment | CommentBegin + | Processing | ProcessingBegin + | CData | CDataBegin + + | StartTag | StartEndTag | EndTag + + | DecChar | HexChar | CharEntity + + | RawData | HtmlCData + + | BadAmpersand | BadGreaterThan | BadLessThan + + | Invalid + | EndOfStream + generate [no_namespace_suffix] # cosmetic: call it h8_id, not h8_id_e +} diff --git a/lazylex/testdata.html b/data_lang/testdata/hello.htm8 similarity index 100% rename from lazylex/testdata.html rename to data_lang/testdata/hello.htm8 diff --git a/lazylex/README.md b/doc/lazylex.md similarity index 100% rename from lazylex/README.md rename to doc/lazylex.md diff --git a/doctools/oils_doc_test.py b/doctools/oils_doc_test.py index c173cf17e9..14fc58a48f 100755 --- a/doctools/oils_doc_test.py +++ b/doctools/oils_doc_test.py @@ -7,7 +7,7 @@ from lazylex import html from doctools import oils_doc # module under test -with open('lazylex/testdata.html') as f: +with open('data_lang/testdata/hello.htm8') as f: TEST_HTML = f.read() @@ -58,7 +58,7 @@ def testShPrompt(self): def testHighlightCode(self): # type: () -> None - # lazylex/testdata.html has the language-sh-prompt + # data_lang/testdata/hello.htm8 has the language-sh-prompt h = oils_doc.HighlightCode(TEST_HTML, None) self.assert_('' in h, h) diff --git a/lazylex/html_test.py b/lazylex/html_test.py index 7cb9f65535..ebe0677b17 100755 --- a/lazylex/html_test.py +++ b/lazylex/html_test.py @@ -9,7 +9,7 @@ log = html.log -with open('lazylex/testdata.html') as f: +with open('data_lang/testdata/hello.htm8') as f: TEST_HTML = f.read()