diff --git a/docs/examples/greeting.txt b/docs/examples/greeting.txt index a522ce9..fdccd1e 100644 --- a/docs/examples/greeting.txt +++ b/docs/examples/greeting.txt @@ -1,5 +1,3 @@ -NewLang 0 - StartNote Copyright 2021 Jookia SPDX-License-Identifier: LGPL-2.1-only diff --git a/docs/examples/menu.txt b/docs/examples/menu.txt index 63cb333..2dd01ae 100644 --- a/docs/examples/menu.txt +++ b/docs/examples/menu.txt @@ -1,5 +1,3 @@ -NewLang 0 - StartNote Copyright 2021 Jookia SPDX-License-Identifier: LGPL-2.1-only diff --git a/docs/syntax.md b/docs/syntax.md index 92d85c7..6beacb7 100644 --- a/docs/syntax.md +++ b/docs/syntax.md @@ -116,29 +116,12 @@ NewLang supports storing code in files. -- NewLang directive +It contains: + - Directives Files must be UTF-8 encoded and use Unix new lines. -#### NewLang directive - -The NewLang directive specifies the version of NewLang used to write the code. - -The NewLang directive consists of two tokens: - -- The literal text 'NewLang' -- The NewLang version number - -Here's an example of specifying version 0: - -``` -NewLang 0 -``` - -This directive is used by NewLang to preserve backwards compatibility with -code written for older versions of itself. - #### Notes Notes allow you to write text intended for other humans to read. @@ -161,7 +144,6 @@ Here's an example of specifying a note among other code: ``` -NewLang 0 StartNote Read the user's name EndNote Set Name To System Read EndSet System Print Name Done @@ -201,7 +183,6 @@ Here's an example: ``` -NewLang 0 System Print StartText Hello, world! EndText Done ``` @@ -233,7 +214,6 @@ Here's an example on using a boolean with an If directive: ``` -NewLang 0 If True Then System Print StartText Hi EndText Else System Print StartText Bye EndText @@ -254,7 +234,6 @@ Here's an example: ``` -NewLang 0 Set Time To StartText Twelve O'Clock EndText EndSet System Print Time Done ``` @@ -289,7 +268,6 @@ Here's an example using a set directive: ``` -NewLang 0 Set UserName To System ReadLine EndSet ``` @@ -315,7 +293,6 @@ Here's an example of multiple directives in a single file: ``` -NewLang 0 Set UserName To System ReadLine EndSet If UserName Equals StartText Jookia EndText Then System Print StartText Hi Jookia EndText @@ -338,7 +315,6 @@ Here's an example of using command directives: ``` -NewLang 0 System Print StartText Hit enter to continue EndText Done System ReadLine Done ``` @@ -366,7 +342,6 @@ Here's an example of using the set directive: ``` -NewLang 0 Set Message To StartText Hi there! EndText System Print Message Done ``` @@ -391,7 +366,6 @@ - A token with the literal text 'EndIf' ``` -NewLang 0 If True Then System Print StartText Success EndText Else System Print StartText Failure EndText diff --git a/src/oldparse.py b/src/oldparse.py index 072797b..7ae38e5 100644 --- a/src/oldparse.py +++ b/src/oldparse.py @@ -160,7 +160,6 @@ def tokenize(self): keywords = [ - "NewLang", "Done", "Set", "To", @@ -239,21 +238,6 @@ token = self.tokens[self.pos] return ParseContext(context, text, token.location) - def parse_version(self, context): - log.log(log.PARSER, log.TRACE, "Parsing version identifier...") - context = self.create_context(context, "parsing version identifier") - token = self.next() - if token.type != "keyword" or token.value != "NewLang": - raise ParseError( - context, "Expected 'NewLang' keyword, got '%s'" % (token.value) - ) - token = self.next() - version = token.value - if version != "0": - raise ParseError(context, "Unknown version '%s'" % (version)) - log.log(log.PARSER, log.DEBUG, "Parsed version %s" % (version)) - return version - def parse_value(self, context, subject, type, value): log.log(log.PARSER, log.TRACE, "Parsing value...") if type == "symbol": @@ -387,7 +371,6 @@ def parse_file(self): log.log(log.PARSER, log.TRACE, "Parsing file...") ast = [] - self.parse_version(None) while not self.eof(): log.log(log.PARSER, log.TRACE, "Parsing next directive in file...") ast.append(self.parse_directive(None)) diff --git a/tests/test_oldparse.py b/tests/test_oldparse.py index 060bc12..6f12220 100644 --- a/tests/test_oldparse.py +++ b/tests/test_oldparse.py @@ -20,7 +20,6 @@ # List of keywords the lexer understands keywords = [ - "NewLang", "Done", "Set", "To", diff --git a/tests/test_syntax.py b/tests/test_syntax.py index c5fea7d..83dc2da 100644 --- a/tests/test_syntax.py +++ b/tests/test_syntax.py @@ -17,7 +17,6 @@ # Keywords recognized by the language keywords = [ - "NewLang", "Done", "Set", "To",