| |
- Method resolution order:
- FCLParser
- antlr3.recognizers.Parser
- antlr3.recognizers.BaseRecognizer
- __builtin__.object
Methods defined here:
- __init__(self, input, state=None)
- accumulation_method(self)
- # $ANTLR start "accumulation_method"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:387:1: accumulation_method : 'ACCU' ':' ( 'MAX' | 'BSUM' | 'NSUM' ) ';' ;
- activation_method(self)
- # $ANTLR start "activation_method"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:385:1: activation_method : 'ACT' ':' ( 'PROD' | 'MIN' ) ';' ;
- conclusion(self)
- # $ANTLR start "conclusion"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:456:1: conclusion returns [adjs] : ( (c1= conclusion2 ) ( ',' c2= conclusion2 )* ) ;
- conclusion2(self)
- # $ANTLR start "conclusion2"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:466:1: conclusion2 returns [adj] : ( ( '(' c2= conclusion3 ')' ) | (c1= conclusion3 ) );
- conclusion3(self)
- # $ANTLR start "conclusion3"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:473:1: conclusion3 returns [adj] : ( (v2= variable_name 'IS' t2= term_name ) ) ;
- condition(self)
- # $ANTLR start "condition"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:392:1: condition returns [input] : (s1= subcondition ) ( (op= ( AND_ | OR_ ) s2= subcondition ) )* ;
- default_value(self, var_name)
- # $ANTLR start "default_value"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:334:1: default_value[var_name] : 'DEFAULT' ':=' ( numeric_literal | 'NC' ) ';' ;
- defuzzification_method(self, var_name)
- # $ANTLR start "defuzzification_method"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:328:1: defuzzification_method[var_name] : 'METHOD' ':' Identifier ';' ;
- defuzzify_block(self)
- # $ANTLR start "defuzzify_block"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:241:1: defuzzify_block : 'DEFUZZIFY' f_variable_name ( linguistic_term[$f_variable_name.text] )* accumulation_method defuzzification_method[$f_variable_name.text] ( default_value[$f_variable_name.text] )? ( range )? 'END_DEFUZZIFY' ;
- f_variable_name(self)
- # $ANTLR start "f_variable_name"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:503:1: f_variable_name : Identifier ;
- fb_io_var_declarations(self)
- # $ANTLR start "fb_io_var_declarations"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:176:1: fb_io_var_declarations : ( input_declarations | output_declarations );
- function_block_body(self)
- # $ANTLR start "function_block_body"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:225:1: function_block_body : ( fuzzify_block )* ( defuzzify_block )* ( rule_block )* ( option_block )* ;
- function_block_declaration(self)
- # $ANTLR start "function_block_declaration"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:156:1: function_block_declaration : 'FUNCTION_BLOCK' function_block_name ( type_definition )* ( fb_io_var_declarations )* function_block_body 'END_FUNCTION_BLOCK' EOF ;
- function_block_name(self)
- # $ANTLR start "function_block_name"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:499:1: function_block_name : Identifier ;
- fuzzify_block(self)
- # $ANTLR start "fuzzify_block"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:233:1: fuzzify_block : 'FUZZIFY' variable_name ( linguistic_term[$variable_name.text] )* 'END_FUZZIFY' ;
- input_declarations(self)
- # $ANTLR start "input_declarations"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:181:1: input_declarations : 'VAR_INPUT' ( var_decl[0] )+ 'END_VAR' ;
- linguistic_term(self, var_name)
- # $ANTLR start "linguistic_term"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:267:1: linguistic_term[var_name] : 'TERM' term_name ':=' membership_function ';' ;
- main(self)
- # $ANTLR start "main"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:154:1: main returns [system] : function_block_declaration ;
- membership_function(self)
- # $ANTLR start "membership_function"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:276:1: membership_function returns [set] : ( singleton | points | pyfuzzy_set );
- numeric_literal(self)
- # $ANTLR start "numeric_literal"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:505:1: numeric_literal : ( Integer_literal | Real_literal );
- operator_definition(self)
- # $ANTLR start "operator_definition"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:376:1: operator_definition : ( (or_name= OR_ ':' or_op= operator_name_OR ) | (and_name= AND_ ':' and_op= operator_name_AND ) ) ';' ;
- operator_name_AND(self)
- # $ANTLR start "operator_name_AND"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:359:1: operator_name_AND returns [op] : ( ( 'MIN' ) | ( 'PROD' ) | ( 'BDIF' ) | (norm= operator_name_any ) );
- operator_name_OR(self)
- # $ANTLR start "operator_name_OR"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:366:1: operator_name_OR returns [op] : ( ( 'MAX' ) | ( 'ASUM' ) | ( 'BSUM' ) | (norm= operator_name_any ) );
- operator_name_any(self)
- # $ANTLR start "operator_name_any"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:347:1: operator_name_any returns [op] : i1= Identifier ( '[' param= numeric_literal ']' )? ;
- option_block(self)
- # $ANTLR start "option_block"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:262:1: option_block : 'OPTION' 'END_OPTION' ;
- output_declarations(self)
- # $ANTLR start "output_declarations"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:182:1: output_declarations : 'VAR_OUTPUT' ( var_decl[1] )+ 'END_VAR' ;
- points(self)
- # $ANTLR start "points"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:292:1: points returns [set] : ( '(' (x= numeric_literal | variable_name ) ',' y= numeric_literal ')' )* ;
- pyfuzzy_set(self)
- # $ANTLR start "pyfuzzy_set"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:308:1: pyfuzzy_set returns [set] : Identifier '(' (p1= numeric_literal ( ',' pn= numeric_literal )* )? ')' ;
- range(self)
- # $ANTLR start "range"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:344:1: range : 'RANGE' ':=' '(' numeric_literal '..' numeric_literal ')' ';' ;
- rule(self, block_name)
- # $ANTLR start "rule"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:482:1: rule[block_name] : 'RULE' Integer_literal ':' 'IF' condition 'THEN' conclusion ( 'WITH' weighting_factor )? ';' ;
- rule_block(self)
- # $ANTLR start "rule_block"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:253:1: rule_block : 'RULEBLOCK' rule_block_name ( operator_definition )* ( activation_method )? ( rule[$rule_block_name.text] )* 'END_RULEBLOCK' ;
- rule_block_name(self)
- # $ANTLR start "rule_block_name"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:501:1: rule_block_name : Identifier ;
- singleton(self)
- # $ANTLR start "singleton"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:285:1: singleton returns [set] : ( numeric_literal | variable_name );
- struct_element(self, struct_name)
- # $ANTLR start "struct_element"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:172:1: struct_element[struct_name] : Identifier ':' 'REAL' ';' ;
- subcondition(self)
- # $ANTLR start "subcondition"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:422:1: subcondition returns [input] : ( ( 'NOT' '(' condition ')' ) | ( subcondition2 ) );
- subcondition2(self)
- # $ANTLR start "subcondition2"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:431:1: subcondition2 returns [input] : ( ( '(' c1= condition ')' ) | ( variable_name ( 'IS' (x= 'NOT' )? | '.' ) term_name ) | (norm= operator_name_any '(' c4= condition ',' c5= condition ')' ) );
- term_name(self)
- # $ANTLR start "term_name"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:502:1: term_name : Identifier ;
- type(self)
- # $ANTLR start "type"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:215:1: type returns [struct_type] : ( 'REAL' | Identifier );
- type_definition(self)
- # $ANTLR start "type_definition"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:168:1: type_definition : 'STRUCT' Identifier ( struct_element[$Identifier.text] )+ 'END_STRUCT' ;
- var_decl(self, output_var)
- # $ANTLR start "var_decl"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:185:1: var_decl[output_var] : Identifier ':' type ';' ;
- variable_name(self)
- # $ANTLR start "variable_name"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:504:1: variable_name : Identifier ;
- weighting_factor(self)
- # $ANTLR start "weighting_factor"
# /work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g:493:1: weighting_factor : numeric_literal ;
Data and other attributes defined here:
- FOLLOW_14_in_function_block_declaration71 = frozenset([4])
- FOLLOW_15_in_function_block_declaration106 = frozenset([])
- FOLLOW_16_in_type_definition126 = frozenset([4])
- FOLLOW_17_in_type_definition136 = frozenset([1])
- FOLLOW_18_in_accumulation_method1116 = frozenset([47, 49, 52])
- FOLLOW_18_in_activation_method1096 = frozenset([44, 45])
- FOLLOW_18_in_defuzzification_method787 = frozenset([4])
- FOLLOW_18_in_operator_definition1055 = frozenset([4, 47, 48, 49])
- FOLLOW_18_in_operator_definition1072 = frozenset([4, 44, 45, 46, 47, 48, ...])
- FOLLOW_18_in_rule1572 = frozenset([57])
- FOLLOW_18_in_struct_element153 = frozenset([19])
- FOLLOW_18_in_var_decl227 = frozenset([4, 19])
- FOLLOW_19_in_struct_element155 = frozenset([20])
- FOLLOW_19_in_type254 = frozenset([1])
- FOLLOW_20_in_accumulation_method1130 = frozenset([1])
- FOLLOW_20_in_activation_method1106 = frozenset([1])
- FOLLOW_20_in_default_value846 = frozenset([1])
- FOLLOW_20_in_defuzzification_method797 = frozenset([1])
- FOLLOW_20_in_linguistic_term504 = frozenset([1])
- FOLLOW_20_in_operator_definition1085 = frozenset([1])
- FOLLOW_20_in_range871 = frozenset([1])
- FOLLOW_20_in_rule1591 = frozenset([1])
- FOLLOW_20_in_struct_element157 = frozenset([1])
- FOLLOW_20_in_var_decl235 = frozenset([1])
- FOLLOW_21_in_input_declarations189 = frozenset([4])
- FOLLOW_22_in_input_declarations195 = frozenset([1])
- FOLLOW_22_in_output_declarations209 = frozenset([1])
- FOLLOW_23_in_output_declarations203 = frozenset([4])
- FOLLOW_24_in_fuzzify_block325 = frozenset([4])
- FOLLOW_25_in_fuzzify_block345 = frozenset([1])
- FOLLOW_26_in_defuzzify_block362 = frozenset([4])
- FOLLOW_27_in_defuzzify_block410 = frozenset([1])
- FOLLOW_28_in_rule_block427 = frozenset([4])
- FOLLOW_29_in_rule_block469 = frozenset([1])
- FOLLOW_30_in_option_block477 = frozenset([31])
- FOLLOW_31_in_option_block481 = frozenset([1])
- FOLLOW_32_in_linguistic_term496 = frozenset([4])
- FOLLOW_33_in_default_value814 = frozenset([8, 9, 39])
- FOLLOW_33_in_linguistic_term500 = frozenset([4, 8, 9, 34])
- FOLLOW_33_in_range859 = frozenset([34])
- FOLLOW_34_in_conclusion21474 = frozenset([4, 34])
- FOLLOW_34_in_points617 = frozenset([4, 8, 9])
- FOLLOW_34_in_pyfuzzy_set704 = frozenset([8, 9, 36])
- FOLLOW_34_in_range861 = frozenset([8, 9])
- FOLLOW_34_in_subcondition1253 = frozenset([4, 34, 47, 48, 49, 53])
- FOLLOW_34_in_subcondition21296 = frozenset([4, 34, 47, 48, 49, 53])
- FOLLOW_34_in_subcondition21362 = frozenset([4, 34, 47, 48, 49, 53])
- FOLLOW_35_in_conclusion1436 = frozenset([4, 34])
- FOLLOW_35_in_points639 = frozenset([8, 9])
- FOLLOW_35_in_pyfuzzy_set732 = frozenset([8, 9])
- FOLLOW_35_in_subcondition21368 = frozenset([4, 34, 47, 48, 49, 53])
- FOLLOW_36_in_conclusion21481 = frozenset([1])
- FOLLOW_36_in_points655 = frozenset([1, 34])
- FOLLOW_36_in_pyfuzzy_set762 = frozenset([1])
- FOLLOW_36_in_range869 = frozenset([20])
- FOLLOW_36_in_subcondition1257 = frozenset([1])
- FOLLOW_36_in_subcondition21302 = frozenset([1])
- FOLLOW_36_in_subcondition21374 = frozenset([1])
- FOLLOW_37_in_defuzzification_method785 = frozenset([18])
- FOLLOW_38_in_default_value812 = frozenset([33])
- FOLLOW_39_in_default_value836 = frozenset([20])
- FOLLOW_40_in_range857 = frozenset([33])
- FOLLOW_41_in_range865 = frozenset([8, 9])
- FOLLOW_42_in_operator_name_any893 = frozenset([8, 9])
- FOLLOW_43_in_operator_name_any899 = frozenset([1])
- FOLLOW_44_in_operator_name_AND922 = frozenset([1])
- FOLLOW_45_in_operator_name_AND932 = frozenset([1])
- FOLLOW_46_in_operator_name_AND942 = frozenset([1])
- FOLLOW_47_in_operator_name_OR976 = frozenset([1])
- FOLLOW_48_in_operator_name_OR986 = frozenset([1])
- FOLLOW_49_in_operator_name_OR996 = frozenset([1])
- FOLLOW_50_in_activation_method1094 = frozenset([18])
- FOLLOW_51_in_accumulation_method1114 = frozenset([18])
- FOLLOW_53_in_subcondition1251 = frozenset([34])
- FOLLOW_53_in_subcondition21329 = frozenset([4])
- FOLLOW_54_in_conclusion31540 = frozenset([4])
- FOLLOW_54_in_subcondition21325 = frozenset([4, 53])
- FOLLOW_55_in_subcondition21334 = frozenset([4])
- FOLLOW_56_in_rule1568 = frozenset([8])
- FOLLOW_57_in_rule1574 = frozenset([4, 34, 47, 48, 49, 53])
- FOLLOW_58_in_rule1578 = frozenset([4, 34])
- FOLLOW_59_in_rule1583 = frozenset([8, 9])
- FOLLOW_AND__in_operator_definition1070 = frozenset([18])
- FOLLOW_EOF_in_function_block_declaration112 = frozenset([1])
- FOLLOW_Identifier_in_defuzzification_method791 = frozenset([20])
- FOLLOW_Identifier_in_f_variable_name1641 = frozenset([1])
- FOLLOW_Identifier_in_function_block_name1617 = frozenset([1])
- FOLLOW_Identifier_in_operator_name_any890 = frozenset([1, 42])
- FOLLOW_Identifier_in_pyfuzzy_set699 = frozenset([34])
- FOLLOW_Identifier_in_rule_block_name1625 = frozenset([1])
- FOLLOW_Identifier_in_struct_element151 = frozenset([18])
- FOLLOW_Identifier_in_term_name1633 = frozenset([1])
- FOLLOW_Identifier_in_type264 = frozenset([1])
- FOLLOW_Identifier_in_type_definition128 = frozenset([4])
- FOLLOW_Identifier_in_var_decl223 = frozenset([18])
- FOLLOW_Identifier_in_variable_name1649 = frozenset([1])
- FOLLOW_Integer_literal_in_rule1570 = frozenset([18])
- FOLLOW_OR__in_operator_definition1053 = frozenset([18])
- FOLLOW_accumulation_method_in_defuzzify_block382 = frozenset([37])
- FOLLOW_activation_method_in_rule_block452 = frozenset([29, 56])
- FOLLOW_conclusion2_in_conclusion1422 = frozenset([1, 35])
- FOLLOW_conclusion2_in_conclusion1440 = frozenset([1, 35])
- FOLLOW_conclusion3_in_conclusion21478 = frozenset([36])
- FOLLOW_conclusion3_in_conclusion21501 = frozenset([1])
- FOLLOW_conclusion_in_rule1580 = frozenset([20, 59])
- FOLLOW_condition_in_rule1576 = frozenset([58])
- FOLLOW_condition_in_subcondition1255 = frozenset([36])
- FOLLOW_condition_in_subcondition21300 = frozenset([36])
- FOLLOW_condition_in_subcondition21366 = frozenset([35])
- FOLLOW_condition_in_subcondition21372 = frozenset([36])
- FOLLOW_default_value_in_defuzzify_block395 = frozenset([27, 40])
- FOLLOW_defuzzification_method_in_defuzzify_block388 = frozenset([27, 38, 40])
- FOLLOW_defuzzify_block_in_function_block_body293 = frozenset([1, 26, 28, 30])
- FOLLOW_f_variable_name_in_defuzzify_block368 = frozenset([32, 51])
- FOLLOW_fb_io_var_declarations_in_function_block_declaration92 = frozenset([15, 21, 23, 24, 26, 28, ...])
- FOLLOW_function_block_body_in_function_block_declaration100 = frozenset([15])
- FOLLOW_function_block_declaration_in_main55 = frozenset([1])
- FOLLOW_function_block_name_in_function_block_declaration77 = frozenset([15, 16, 21, 23, 24, 26, ...])
- FOLLOW_fuzzify_block_in_function_block_body286 = frozenset([1, 24, 26, 28, 30])
- FOLLOW_input_declarations_in_fb_io_var_declarations172 = frozenset([1])
- FOLLOW_linguistic_term_in_defuzzify_block374 = frozenset([32, 51])
- FOLLOW_linguistic_term_in_fuzzify_block337 = frozenset([25, 32])
- FOLLOW_membership_function_in_linguistic_term502 = frozenset([20])
- FOLLOW_numeric_literal_in_default_value824 = frozenset([20])
- FOLLOW_numeric_literal_in_operator_name_any897 = frozenset([43])
- FOLLOW_numeric_literal_in_points627 = frozenset([35])
- FOLLOW_numeric_literal_in_points648 = frozenset([36])
- FOLLOW_numeric_literal_in_pyfuzzy_set716 = frozenset([35, 36])
- FOLLOW_numeric_literal_in_pyfuzzy_set742 = frozenset([35, 36])
- FOLLOW_numeric_literal_in_range863 = frozenset([41])
- FOLLOW_numeric_literal_in_range867 = frozenset([36])
- FOLLOW_numeric_literal_in_singleton573 = frozenset([1])
- FOLLOW_numeric_literal_in_weighting_factor1606 = frozenset([1])
- FOLLOW_operator_definition_in_rule_block443 = frozenset([6, 7, 29, 50, 56])
- FOLLOW_operator_name_AND_in_operator_definition1076 = frozenset([20])
- FOLLOW_operator_name_OR_in_operator_definition1059 = frozenset([20])
- FOLLOW_operator_name_any_in_operator_name_AND955 = frozenset([1])
- FOLLOW_operator_name_any_in_operator_name_OR1009 = frozenset([1])
- FOLLOW_operator_name_any_in_subcondition21360 = frozenset([34])
- FOLLOW_option_block_in_function_block_body307 = frozenset([1, 30])
- FOLLOW_output_declarations_in_fb_io_var_declarations178 = frozenset([1])
- FOLLOW_points_in_membership_function538 = frozenset([1])
- FOLLOW_pyfuzzy_set_in_membership_function550 = frozenset([1])
- FOLLOW_range_in_defuzzify_block403 = frozenset([27])
- FOLLOW_rule_block_in_function_block_body300 = frozenset([1, 28, 30])
- FOLLOW_rule_block_name_in_rule_block435 = frozenset([6, 7, 29, 50, 56])
- FOLLOW_rule_in_rule_block461 = frozenset([29, 56])
- FOLLOW_set_in_accumulation_method1118 = frozenset([20])
- FOLLOW_set_in_activation_method1098 = frozenset([20])
- FOLLOW_set_in_condition1189 = frozenset([4, 34, 47, 48, 49, 53])
- FOLLOW_set_in_numeric_literal0 = frozenset([1])
- FOLLOW_singleton_in_membership_function526 = frozenset([1])
- FOLLOW_struct_element_in_type_definition132 = frozenset([4, 17])
- FOLLOW_subcondition2_in_subcondition1269 = frozenset([1])
- FOLLOW_subcondition_in_condition1161 = frozenset([1, 6, 7])
- FOLLOW_subcondition_in_condition1211 = frozenset([1, 6, 7])
- FOLLOW_term_name_in_conclusion31544 = frozenset([1])
- FOLLOW_term_name_in_linguistic_term498 = frozenset([33])
- FOLLOW_term_name_in_subcondition21338 = frozenset([1])
- FOLLOW_type_definition_in_function_block_declaration85 = frozenset([15, 16, 21, 23, 24, 26, ...])
- FOLLOW_type_in_var_decl231 = frozenset([20])
- FOLLOW_var_decl_in_input_declarations191 = frozenset([4, 22])
- FOLLOW_var_decl_in_output_declarations205 = frozenset([4, 22])
- FOLLOW_variable_name_in_conclusion31538 = frozenset([54])
- FOLLOW_variable_name_in_fuzzify_block331 = frozenset([25, 32])
- FOLLOW_variable_name_in_points631 = frozenset([35])
- FOLLOW_variable_name_in_singleton585 = frozenset([1])
- FOLLOW_variable_name_in_subcondition21322 = frozenset([54, 55])
- FOLLOW_weighting_factor_in_rule1585 = frozenset([20])
- antlr_version = (3, 1, 2, 2147483647)
- antlr_version_str = '3.1.2'
- f_variable_name_return = <class 'fuzzy.storage.fcl.FCLParser.f_variable_name_return'>
- function_block_name_return = <class 'fuzzy.storage.fcl.FCLParser.function_block_name_return'>
- grammarFileName = '/work/projects/pyfuzzy/pyfuzzy/fuzzy/storage/fcl/FCL.g'
- numeric_literal_return = <class 'fuzzy.storage.fcl.FCLParser.numeric_literal_return'>
- rule_block_name_return = <class 'fuzzy.storage.fcl.FCLParser.rule_block_name_return'>
- term_name_return = <class 'fuzzy.storage.fcl.FCLParser.term_name_return'>
- tokenNames = ['<invalid>', '<EOR>', '<DOWN>', '<UP>', 'Identifier', 'DIGIT', 'OR_', 'AND_', 'Integer_literal', 'Real_literal', 'LETTER', 'Integer_literal_wo_sign', 'WS', 'COMMENT', "'FUNCTION_BLOCK'", "'END_FUNCTION_BLOCK'", "'STRUCT'", "'END_STRUCT'", "':'", "'REAL'", ...]
- variable_name_return = <class 'fuzzy.storage.fcl.FCLParser.variable_name_return'>
- weighting_factor_return = <class 'fuzzy.storage.fcl.FCLParser.weighting_factor_return'>
Methods inherited from antlr3.recognizers.Parser:
- getCurrentInputSymbol(self, input)
- getMissingSymbol(self, input, e, expectedTokenType, follow)
- getSourceName(self)
- getTokenStream(self)
- reset(self)
- setTokenStream(self, input)
- Set the token stream and reset the parser
- traceIn(self, ruleName, ruleIndex)
- traceOut(self, ruleName, ruleIndex)
Methods inherited from antlr3.recognizers.BaseRecognizer:
- alreadyParsedRule(self, input, ruleIndex)
- Has this rule already parsed input at the current index in the
input stream? Return the stop token index or MEMO_RULE_UNKNOWN.
If we attempted but failed to parse properly before, return
MEMO_RULE_FAILED.
This method has a side-effect: if we have seen this input for
this rule and successfully parsed before, then seek ahead to
1 past the stop token matched for this rule last time.
- beginResync(self)
- A hook to listen in on the token consumption during error recovery.
The DebugParser subclasses this to fire events to the listenter.
- combineFollows(self, exact)
- computeContextSensitiveRuleFOLLOW(self)
- Compute the context-sensitive FOLLOW set for current rule.
This is set of token types that can follow a specific rule
reference given a specific call chain. You get the set of
viable tokens that can possibly come next (lookahead depth 1)
given the current call chain. Contrast this with the
definition of plain FOLLOW for rule r:
FOLLOW(r)={x | S=>*alpha r beta in G and x in FIRST(beta)}
where x in T* and alpha, beta in V*; T is set of terminals and
V is the set of terminals and nonterminals. In other words,
FOLLOW(r) is the set of all tokens that can possibly follow
references to r in *any* sentential form (context). At
runtime, however, we know precisely which context applies as
we have the call chain. We may compute the exact (rather
than covering superset) set of following tokens.
For example, consider grammar:
stat : ID '=' expr ';' // FOLLOW(stat)=={EOF}
| "return" expr '.'
;
expr : atom ('+' atom)* ; // FOLLOW(expr)=={';','.',')'}
atom : INT // FOLLOW(atom)=={'+',')',';','.'}
| '(' expr ')'
;
The FOLLOW sets are all inclusive whereas context-sensitive
FOLLOW sets are precisely what could follow a rule reference.
For input input "i=(3);", here is the derivation:
stat => ID '=' expr ';'
=> ID '=' atom ('+' atom)* ';'
=> ID '=' '(' expr ')' ('+' atom)* ';'
=> ID '=' '(' atom ')' ('+' atom)* ';'
=> ID '=' '(' INT ')' ('+' atom)* ';'
=> ID '=' '(' INT ')' ';'
At the "3" token, you'd have a call chain of
stat -> expr -> atom -> expr -> atom
What can follow that specific nested ref to atom? Exactly ')'
as you can see by looking at the derivation of this specific
input. Contrast this with the FOLLOW(atom)={'+',')',';','.'}.
You want the exact viable token set when recovering from a
token mismatch. Upon token mismatch, if LA(1) is member of
the viable next token set, then you know there is most likely
a missing token in the input stream. "Insert" one by just not
throwing an exception.
- computeErrorRecoverySet(self)
- Compute the error recovery set for the current rule. During
rule invocation, the parser pushes the set of tokens that can
follow that rule reference on the stack; this amounts to
computing FIRST of what follows the rule reference in the
enclosing rule. This local follow set only includes tokens
from within the rule; i.e., the FIRST computation done by
ANTLR stops at the end of a rule.
EXAMPLE
When you find a "no viable alt exception", the input is not
consistent with any of the alternatives for rule r. The best
thing to do is to consume tokens until you see something that
can legally follow a call to r *or* any rule that called r.
You don't want the exact set of viable next tokens because the
input might just be missing a token--you might consume the
rest of the input looking for one of the missing tokens.
Consider grammar:
a : '[' b ']'
| '(' b ')'
;
b : c '^' INT ;
c : ID
| INT
;
At each rule invocation, the set of tokens that could follow
that rule is pushed on a stack. Here are the various "local"
follow sets:
FOLLOW(b1_in_a) = FIRST(']') = ']'
FOLLOW(b2_in_a) = FIRST(')') = ')'
FOLLOW(c_in_b) = FIRST('^') = '^'
Upon erroneous input "[]", the call chain is
a -> b -> c
and, hence, the follow context stack is:
depth local follow set after call to rule
0 \<EOF> a (from main())
1 ']' b
3 '^' c
Notice that ')' is not included, because b would have to have
been called from a different context in rule a for ')' to be
included.
For error recovery, we cannot consider FOLLOW(c)
(context-sensitive or otherwise). We need the combined set of
all context-sensitive FOLLOW sets--the set of all tokens that
could follow any reference in the call chain. We need to
resync to one of those tokens. Note that FOLLOW(c)='^' and if
we resync'd to that token, we'd consume until EOF. We need to
sync to context-sensitive FOLLOWs for a, b, and c: {']','^'}.
In this case, for input "[]", LA(1) is in this set so we would
not consume anything and after printing an error rule c would
return normally. It would not find the required '^' though.
At this point, it gets a mismatched token error and throws an
exception (since LA(1) is not in the viable following token
set). The rule exception handler tries to recover, but finds
the same recovery set and doesn't consume anything. Rule b
exits normally returning to rule a. Now it finds the ']' (and
with the successful match exits errorRecovery mode).
So, you cna see that the parser walks up call chain looking
for the token that was a member of the recovery set.
Errors are not generated in errorRecovery mode.
ANTLR's error recovery mechanism is based upon original ideas:
"Algorithms + Data Structures = Programs" by Niklaus Wirth
and
"A note on error recovery in recursive descent parsers":
http://portal.acm.org/citation.cfm?id=947902.947905
Later, Josef Grosch had some good ideas:
"Efficient and Comfortable Error Recovery in Recursive Descent
Parsers":
ftp://www.cocolab.com/products/cocktail/doca4.ps/ell.ps.zip
Like Grosch I implemented local FOLLOW sets that are combined
at run-time upon error to avoid overhead during parsing.
- consumeUntil(self, input, tokenTypes)
- Consume tokens until one matches the given token or token set
tokenTypes can be a single token type or a set of token types
- displayRecognitionError(self, tokenNames, e)
- emitErrorMessage(self, msg)
- Override this method to change where error messages go
- endResync(self)
- A hook to listen in on the token consumption during error recovery.
The DebugParser subclasses this to fire events to the listenter.
- failed(self)
- Return whether or not a backtracking attempt failed.
- getBacktrackingLevel(self)
- getErrorHeader(self, e)
- What is the error header, normally line/character position information?
- getErrorMessage(self, e, tokenNames)
- What error message should be generated for the various
exception types?
Not very object-oriented code, but I like having all error message
generation within one method rather than spread among all of the
exception classes. This also makes it much easier for the exception
handling because the exception classes do not have to have pointers back
to this object to access utility routines and so on. Also, changing
the message for an exception type would be difficult because you
would have to subclassing exception, but then somehow get ANTLR
to make those kinds of exception objects instead of the default.
This looks weird, but trust me--it makes the most sense in terms
of flexibility.
For grammar debugging, you will want to override this to add
more information such as the stack frame with
getRuleInvocationStack(e, this.getClass().getName()) and,
for no viable alts, the decision description and state etc...
Override this to change the message generated for one or more
exception types.
- getGrammarFileName(self)
- For debugging and other purposes, might want the grammar name.
Have ANTLR generate an implementation for this method.
- getNumberOfSyntaxErrors(self)
- Get number of recognition errors (lexer, parser, tree parser). Each
recognizer tracks its own number. So parser and lexer each have
separate count. Does not count the spurious errors found between
an error and next valid token match
See also reportError()
- getRuleInvocationStack(self)
- Return List<String> of the rules in your parser instance
leading up to a call to this method. You could override if
you want more details such as the file/line info of where
in the parser java code a rule is invoked.
This is very useful for error messages and for context-sensitive
error recovery.
You must be careful, if you subclass a generated recognizers.
The default implementation will only search the module of self
for rules, but the subclass will not contain any rules.
You probably want to override this method to look like
def getRuleInvocationStack(self):
return _getRuleInvocationStack(<class>.__module__)
where <class> is the class of the generated recognizer, e.g.
the superclass of self.
- getRuleMemoization(self, ruleIndex, ruleStartIndex)
- Given a rule number and a start token index number, return
MEMO_RULE_UNKNOWN if the rule has not parsed input starting from
start index. If this rule has parsed input starting from the
start index before, then return where the rule stopped parsing.
It returns the index of the last token matched by the rule.
- getTokenErrorDisplay(self, t)
- How should a token be displayed in an error message? The default
is to display just the text, but during development you might
want to have a lot of information spit out. Override in that case
to use t.toString() (which, for CommonToken, dumps everything about
the token). This is better than forcing you to override a method in
your token objects because you don't have to go modify your lexer
so that it creates a new Java type.
- match(self, input, ttype, follow)
- Match current input symbol against ttype. Attempt
single token insertion or deletion error recovery. If
that fails, throw MismatchedTokenException.
To turn off single token insertion or deletion error
recovery, override recoverFromMismatchedToken() and have it
throw an exception. See TreeParser.recoverFromMismatchedToken().
This way any error in a rule will cause an exception and
immediate exit from rule. Rule would recover by resynchronizing
to the set of symbols that can follow rule ref.
- matchAny(self, input)
- Match the wildcard: in a symbol
- memoize(self, input, ruleIndex, ruleStartIndex, success)
- Record whether or not this rule parsed the input at this position
successfully.
- mismatchIsMissingToken(self, input, follow)
- mismatchIsUnwantedToken(self, input, ttype)
- recover(self, input, re)
- Recover from an error found on the input stream. This is
for NoViableAlt and mismatched symbol exceptions. If you enable
single token insertion and deletion, this will usually not
handle mismatched symbol exceptions but there could be a mismatched
token that the match() routine could not recover from.
- recoverFromMismatchedSet(self, input, e, follow)
- Not currently used
- recoverFromMismatchedToken(self, input, ttype, follow)
- Attempt to recover from a single missing or extra token.
EXTRA TOKEN
LA(1) is not what we are looking for. If LA(2) has the right token,
however, then assume LA(1) is some extra spurious token. Delete it
and LA(2) as if we were doing a normal match(), which advances the
input.
MISSING TOKEN
If current token is consistent with what could come after
ttype then it is ok to 'insert' the missing token, else throw
exception For example, Input 'i=(3;' is clearly missing the
')'. When the parser returns from the nested call to expr, it
will have call chain:
stat -> expr -> atom
and it will be trying to match the ')' at this point in the
derivation:
=> ID '=' '(' INT ')' ('+' atom)* ';'
^
match() will see that ';' doesn't match ')' and report a
mismatched token error. To recover, it sees that LA(1)==';'
is in the set of tokens that can follow the ')' token
reference in rule atom. It can assume that you forgot the ')'.
- reportError(self, e)
- Report a recognition problem.
This method sets errorRecovery to indicate the parser is recovering
not parsing. Once in recovery mode, no errors are generated.
To get out of recovery mode, the parser must successfully match
a token (after a resync). So it will go:
1. error occurs
2. enter recovery mode, report error
3. consume until token found in resynch set
4. try to resume parsing
5. next match() will reset errorRecovery mode
If you override, make sure to update syntaxErrors if you care about
that.
- setBacktrackingLevel(self, n)
- setInput(self, input)
- # this one only exists to shut up pylint :(
- toStrings(self, tokens)
- A convenience method for use most often with template rewrites.
Convert a List<Token> to List<String>
Data descriptors inherited from antlr3.recognizers.BaseRecognizer:
- __dict__
- dictionary for instance variables (if defined)
- __weakref__
- list of weak references to the object (if defined)
Data and other attributes inherited from antlr3.recognizers.BaseRecognizer:
- DEFAULT_TOKEN_CHANNEL = 0
- HIDDEN = 99
- MEMO_RULE_FAILED = -2
- MEMO_RULE_UNKNOWN = -1
|