Changeset 1560 for cobra/trunk/Source/CobraParser.cobra
- Timestamp:
- 07/30/08 02:34:05 (5 months ago)
- Files:
-
- 1 modified
-
cobra/trunk/Source/CobraParser.cobra (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
cobra/trunk/Source/CobraParser.cobra
r1553 r1560 851 851 return theStruct 852 852 853 def eventDecl as BoxEvent 854 token = .expect('EVENT') 855 name = .expect('ID').value to String 856 .expect('AS') 857 handlerType = .typeId 858 # ahem, duplicated from .boxVarDecl 859 docString = '' to ? 860 isNames = List<of String>(_isNamesStack) 861 if .peek.which=='IS' 862 isNames = .isDeclNames 863 attribs = .hasAttribs 864 assert .last.which=='EOL' 865 .undo # need the EOL 866 if .optionalIndent 867 docString = .docString 868 .dedent 869 else if .optionalIndent 870 isNames = .isDeclNames 871 attribs = .hasAttribs 872 docString = .docString 873 .dedent 874 else 875 attribs = AttributeList() 876 return BoxEvent(token, .curBox, name, isNames, attribs, docString, handlerType) 877 853 878 def enumDecl as EnumDecl 854 879 token = .expect('ENUM') … … 1023 1048 on 'EOL', .endOfLine 1024 1049 on 'ENUM', .addDecl(box, .enumDecl) 1050 on 'EVENT', .addDecl(box, .eventDecl) 1025 1051 on 'SIG', .addDecl(box, .declareMethodSig) 1026 1052 on 'SHARED', .bodiedBoxMemberDeclsShared(box) … … 1094 1120 docString = .docString 1095 1121 .dedent 1096 else 1097 if .optionalIndent 1098 isNames = .isDeclNames 1099 attribs = .hasAttribs 1100 docString = .docString 1101 .dedent 1122 else if .optionalIndent 1123 isNames = .isDeclNames 1124 attribs = .hasAttribs 1125 docString = .docString 1126 .dedent 1102 1127 return BoxVar(tok, .curBox, identifier, type, isNames, initExpr, docString) 1103 1128 … … 2036 2061 2037 2062 def raiseStmt as Stmt 2038 .expect('RAISE') 2039 .throwError('The "raise" keyword may be used in the future to raise events. If you are trying to throw an exception, use the "throw" keyword.') 2040 return nil to passthrough # CC: throw FallThroughException() 2063 token = .expect('RAISE') 2064 exprs = .commaSepExprs('EOL') 2065 if exprs.count == 0 2066 .throwError('Expecting one or more expressions after "raise", starting with the event. If you meant to throw the currently caught exception, use "throw" instead.') 2067 return RaiseStmt(token, exprs) 2041 2068 2042 2069 def returnStmt as Stmt
