Beispiel #1
0
 void ReportUnexpectedToken(ConfigToken token)
 {
     if (token.Type == ConfigTokenType.Error)
     {
         ReporterHelper.AddError(_reporter, token, token.Text);
     }
     else if (token.Type == ConfigTokenType.EOF)
     {
         ReporterHelper.AddError(_reporter, token, "Unexpected end of file.");
     }
     else
     {
         ReporterHelper.AddError(_reporter, token, "Unexpected Token.");
     }
 }
Beispiel #2
0
 protected override ConfigSetting Reduce_Setting_2(ConfigToken errorSeg)
 {
     ReportUnexpectedToken(errorSeg);
     return(null);
 }
Beispiel #3
0
 protected override ConfigState Reduce_State_1(ConfigToken labelSeg, ConfigState ruleListSeg)
 {
     ruleListSeg.Label = labelSeg;
     return(ruleListSeg);
 }
Beispiel #4
0
 protected override ConfigState Reduce_RuleList_2(ConfigToken errorSeg)
 {
     ReportUnexpectedToken(errorSeg);
     return(new ConfigState());
 }
Beispiel #5
0
 protected override ConfigSetting Reduce_Setting_1(ConfigToken labelSeg, ConfigToken settingValueSeg)
 {
     return(new ConfigSetting(labelSeg, settingValueSeg));
 }
Beispiel #6
0
 protected override ConfigRule Reduce_Rule_2(ConfigToken errorSeg)
 {
     ReportUnexpectedToken(errorSeg);
     return(null);
 }
Beispiel #7
0
 protected override ConfigRule Reduce_Rule_1(ConfigToken regexSeg, ConfigToken labelSeg)
 {
     return(new ConfigRule(regexSeg, labelSeg));
 }
Beispiel #8
0
 protected override Config Reduce_ConfigSettings_3(ConfigToken errorSeg)
 {
     ReportUnexpectedToken(errorSeg);
     return(new Config());
 }
Beispiel #9
0
 protected override Config Reduce_ConfigSettings_2(Config configSettingsSeg, ConfigToken errorSeg)
 {
     ReportUnexpectedToken(errorSeg);
     return(configSettingsSeg);
 }
Beispiel #10
0
 protected override ConfigTokenType GetTokenType(ConfigToken terminal) => terminal.Type;