summaryrefslogtreecommitdiffstats
path: root/Grammar
diff options
context:
space:
mode:
Diffstat (limited to 'Grammar')
-rw-r--r--Grammar/Grammar20
1 files changed, 13 insertions, 7 deletions
diff --git a/Grammar/Grammar b/Grammar/Grammar
index 8464cf2..cb4bc27 100644
--- a/Grammar/Grammar
+++ b/Grammar/Grammar
@@ -2,6 +2,12 @@
# Change log:
+# 19-May-93:
+# Add access statement
+
+# 18-May-93:
+# Abolish old class header syntax
+
# 06-Apr-92:
# Use only '*' for varargs list
@@ -81,7 +87,7 @@ fplist: fpdef (',' fpdef)* [',']
stmt: simple_stmt | compound_stmt
simple_stmt: small_stmt (';' small_stmt)* [';'] NEWLINE
-small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt
+small_stmt: expr_stmt | print_stmt | del_stmt | pass_stmt | flow_stmt | import_stmt | global_stmt | access_stmt
expr_stmt: (exprlist '=')* exprlist
# For assignments, additional restrictions enforced by the interpreter
print_stmt: 'print' (test ',')* [test]
@@ -94,6 +100,11 @@ return_stmt: 'return' [testlist]
raise_stmt: 'raise' test [',' test]
import_stmt: 'import' NAME (',' NAME)* | 'from' NAME 'import' ('*' | NAME (',' NAME)*)
global_stmt: 'global' NAME (',' NAME)*
+access_stmt: 'access' NAME (',' NAME)* ':' accesstype (',' accesstype)*
+accesstype: NAME+
+# accesstype should be ('public' | 'protected' | 'private') ['read'] ['write']
+# but can't be because that would create undesirable reserved words!
+
compound_stmt: if_stmt | while_stmt | for_stmt | try_stmt | funcdef | classdef
if_stmt: 'if' test ':' suite ('elif' test ':' suite)* ['else' ':' suite]
while_stmt: 'while' test ':' suite ['else' ':' suite]
@@ -122,9 +133,4 @@ exprlist: expr (',' expr)* [',']
testlist: test (',' test)* [',']
dictmaker: test ':' test (',' test ':' test)* [',']
-# New class syntax should be:
-# classdef: class NAME ['(' testlist ')'] ':' suite
-# but merged with old syntax for compatibility it becomes:
-classdef: 'class' NAME ['(' testlist ')' |'(' ')' ['=' baselist]] ':' suite
-baselist: atom arguments (',' atom arguments)*
-arguments: '(' ')'
+classdef: class NAME ['(' testlist ')'] ':' suite