将Antlr 3语法转换为Antlr 4.这是MySQL的解析器,它是用v3编写的,我试图转换为v4。错误在底部的行上有'finally'。错误说“ “最后''错过EOF
// Comment from server yacc grammar:
// Keywords that we allow for labels in SPs. Anything that's the beginning of a statement
// or characteristics must be in keyword above, otherwise we get (harmful) shift/reduce conflicts.
// Additionally:
// The keywords are only roughly sorted to stay with the same order as in sql_yacc.yy (for simpler diff'ing).
keyword_sp:
ACTION_SYMBOL
| ADDDATE_SYMBOL
| AFTER_SYMBOL
| AGAINST_SYMBOL
| AGGREGATE_SYMBOL
| ALGORITHM_SYMBOL
| ANALYZE_SYMBOL
| ANY_SYMBOL
| AT_SYMBOL
| AUTHORS_SYMBOL
| AUTO_INCREMENT_SYMBOL
| AUTOEXTEND_SIZE_SYMBOL
| AVG_ROW_LENGTH_SYMBOL
| AVG_SYMBOL
| BINLOG_SYMBOL
| BIT_SYMBOL
| BLOCK_SYMBOL
| BOOL_SYMBOL
| BOOLEAN_SYMBOL
| BTREE_SYMBOL
| CASCADED_SYMBOL
| CATALOG_NAME_SYMBOL
| CHAIN_SYMBOL
| CHANGED_SYMBOL
| CHANNEL_SYMBOL // Conditionally set in the lexer.
| CIPHER_SYMBOL
| CLIENT_SYMBOL
| CLASS_ORIGIN_SYMBOL
| COALESCE_SYMBOL
| CODE_SYMBOL
| COLLATION_SYMBOL
| COLUMN_NAME_SYMBOL
| COLUMN_FORMAT_SYMBOL
| COLUMNS_SYMBOL
| COMMITTED_SYMBOL
| COMPACT_SYMBOL
| COMPLETION_SYMBOL
| COMPRESSED_SYMBOL
| COMPRESSION_SYMBOL // Conditionally set in the lexer.
| CONCURRENT_SYMBOL
| CONNECTION_SYMBOL
| CONSISTENT_SYMBOL
| CONSTRAINT_CATALOG_SYMBOL
| CONSTRAINT_SCHEMA_SYMBOL
| CONSTRAINT_NAME_SYMBOL
| CONTEXT_SYMBOL
| CONTRIBUTORS_SYMBOL
| CPU_SYMBOL
| CUBE_SYMBOL
| CURRENT_SYMBOL
| CURSOR_NAME_SYMBOL
| DATA_SYMBOL
| DATAFILE_SYMBOL
| DATETIME_SYMBOL
| DATE_SYMBOL
| DAY_SYMBOL
| DEFAULT_AUTH_SYMBOL
| DEFINER_SYMBOL
| DELAY_KEY_WRITE_SYMBOL
| DES_KEY_FILE_SYMBOL
| DIAGNOSTICS_SYMBOL
| DIRECTORY_SYMBOL
| DISABLE_SYMBOL
| DISCARD_SYMBOL
| DISK_SYMBOL
| DUMPFILE_SYMBOL
| DUPLICATE_SYMBOL
| DYNAMIC_SYMBOL
| ENDS_SYMBOL
| ENUM_SYMBOL
| ENGINE_SYMBOL
| ENGINES_SYMBOL
| ERROR_SYMBOL
| ERRORS_SYMBOL
| ESCAPE_SYMBOL
| EVENT_SYMBOL
| EVENTS_SYMBOL
| EVERY_SYMBOL
| EXPANSION_SYMBOL
| EXPORT_SYMBOL
| EXTENDED_SYMBOL
| EXTENT_SIZE_SYMBOL
| FAULTS_SYMBOL
| FAST_SYMBOL
| FOUND_SYMBOL
| ENABLE_SYMBOL
| FULL_SYMBOL
| FILE_SYMBOL
| FILE_BLOCK_SIZE_SYMBOL // Conditionally set in the lexer.
| FILTER_SYMBOL
| FIRST_SYMBOL
| FIXED_SYMBOL
| GENERAL_SYMBOL
| GEOMETRY_SYMBOL
| GEOMETRYCOLLECTION_SYMBOL
| GET_FORMAT_SYMBOL
| GRANTS_SYMBOL
| GLOBAL_SYMBOL
| HASH_SYMBOL
| HOSTS_SYMBOL
| HOUR_SYMBOL
| IDENTIFIED_SYMBOL
| IGNORE_SERVER_IDS_SYMBOL
| INVOKER_SYMBOL
| IMPORT_SYMBOL
| INDEXES_SYMBOL
| INITIAL_SIZE_SYMBOL
| INNODB_SYMBOL // Conditionally deprecated in the lexer rule.
| IO_SYMBOL
| IPC_SYMBOL
| ISOLATION_SYMBOL
| ISSUER_SYMBOL
| INSERT_METHOD_SYMBOL
| KEY_BLOCK_SIZE_SYMBOL
| LAST_SYMBOL
| LEAVES_SYMBOL
| LESS_SYMBOL
| LEVEL_SYMBOL
| LINESTRING_SYMBOL
| LIST_SYMBOL
| LOCAL_SYMBOL
| LOCKS_SYMBOL
| LOGFILE_SYMBOL
| LOGS_SYMBOL
| MAX_ROWS_SYMBOL
| MASTER_SYMBOL
| MASTER_HEARTBEAT_PERIOD_SYMBOL
| MASTER_HOST_SYMBOL
| MASTER_PORT_SYMBOL
| MASTER_LOG_FILE_SYMBOL
| MASTER_LOG_POS_SYMBOL
| MASTER_USER_SYMBOL
| MASTER_PASSWORD_SYMBOL
| MASTER_SERVER_ID_SYMBOL
| MASTER_CONNECT_RETRY_SYMBOL
| MASTER_RETRY_COUNT_SYMBOL
| MASTER_DELAY_SYMBOL
| MASTER_SSL_SYMBOL
| MASTER_SSL_CA_SYMBOL
| MASTER_SSL_CAPATH_SYMBOL
| MASTER_SSL_CERT_SYMBOL
| MASTER_SSL_CIPHER_SYMBOL
| MASTER_SSL_CRL_SYMBOL
| MASTER_SSL_CRLPATH_SYMBOL
| MASTER_SSL_KEY_SYMBOL
| MASTER_AUTO_POSITION_SYMBOL
| MAX_CONNECTIONS_PER_HOUR_SYMBOL
| MAX_QUERIES_PER_HOUR_SYMBOL
| MAX_STATEMENT_TIME_SYMBOL
| MAX_SIZE_SYMBOL
| MAX_UPDATES_PER_HOUR_SYMBOL
| MAX_USER_CONNECTIONS_SYMBOL
| MEDIUM_SYMBOL
| MEMORY_SYMBOL
| MERGE_SYMBOL
| MESSAGE_TEXT_SYMBOL
| MICROSECOND_SYMBOL
| MIGRATE_SYMBOL
| MINUTE_SYMBOL
| MIN_ROWS_SYMBOL
| MODIFY_SYMBOL
| MODE_SYMBOL
| MONTH_SYMBOL
| MULTILINESTRING_SYMBOL
| MULTIPOINT_SYMBOL
| MULTIPOLYGON_SYMBOL
| MUTEX_SYMBOL
| MYSQL_ERRNO_SYMBOL
| NAME_SYMBOL
| NAMES_SYMBOL
| NATIONAL_SYMBOL
| NCHAR_SYMBOL
| NDBCLUSTER_SYMBOL
| NEVER_SYMBOL
| NEXT_SYMBOL
| NEW_SYMBOL
| NO_WAIT_SYMBOL
| NODEGROUP_SYMBOL
| NONE_SYMBOL
| NUMBER_SYMBOL
| NVARCHAR_SYMBOL
| OFFSET_SYMBOL
| OLD_PASSWORD_SYMBOL
| ONE_SHOT_SYMBOL
| ONE_SYMBOL
| PACK_KEYS_SYMBOL
| PAGE_SYMBOL
| PARTIAL_SYMBOL
| PARTITIONING_SYMBOL
| PARTITIONS_SYMBOL
| PASSWORD_SYMBOL
| PHASE_SYMBOL
| PLUGIN_DIR_SYMBOL
| PLUGIN_SYMBOL
| PLUGINS_SYMBOL
| POINT_SYMBOL
| POLYGON_SYMBOL
| PRESERVE_SYMBOL
| PREV_SYMBOL
| PRIVILEGES_SYMBOL
| PROCESS_SYMBOL
| PROCESSLIST_SYMBOL
| PROFILE_SYMBOL
| PROFILES_SYMBOL
| PROXY_SYMBOL
| QUARTER_SYMBOL
| QUERY_SYMBOL
| QUICK_SYMBOL
| READ_ONLY_SYMBOL
| REBUILD_SYMBOL
| RECOVER_SYMBOL
| REDO_BUFFER_SIZE_SYMBOL
| REDOFILE_SYMBOL
| REDUNDANT_SYMBOL
| RELAY_SYMBOL
| RELAYLOG_SYMBOL
| RELAY_LOG_FILE_SYMBOL
| RELAY_LOG_POS_SYMBOL
| RELAY_THREAD_SYMBOL
| RELOAD_SYMBOL
| REORGANIZE_SYMBOL
| REPEATABLE_SYMBOL
| REPLICATION_SYMBOL
| REPLICATE_DO_DB_SYMBOL
| REPLICATE_IGNORE_DB_SYMBOL
| REPLICATE_DO_TABLE_SYMBOL
| REPLICATE_IGNORE_TABLE_SYMBOL
| REPLICATE_WILD_DO_TABLE_SYMBOL
| REPLICATE_WILD_IGNORE_TABLE_SYMBOL
| REPLICATE_REWRITE_DB_SYMBOL
| RESUME_SYMBOL
| RETURNED_SQLSTATE_SYMBOL
| RETURNS_SYMBOL
| REVERSE_SYMBOL
| ROLLUP_SYMBOL
| ROUTINE_SYMBOL
| ROWS_SYMBOL
| ROW_COUNT_SYMBOL
| ROW_FORMAT_SYMBOL
| ROW_SYMBOL
| RTREE_SYMBOL
| SCHEDULE_SYMBOL
| SCHEMA_NAME_SYMBOL
| SECOND_SYMBOL
| SERIAL_SYMBOL
| SERIALIZABLE_SYMBOL
| SESSION_SYMBOL
| SIMPLE_SYMBOL
| SHARE_SYMBOL
| SHUTDOWN_SYMBOL
| SLOW_SYMBOL
| SNAPSHOT_SYMBOL
| SOUNDS_SYMBOL
| SOURCE_SYMBOL
| SQL_AFTER_GTIDS_SYMBOL
| SQL_AFTER_MTS_GAPS_SYMBOL
| SQL_BEFORE_GTIDS_SYMBOL
| SQL_CACHE_SYMBOL
| SQL_BUFFER_RESULT_SYMBOL
| SQL_NO_CACHE_SYMBOL
| SQL_THREAD_SYMBOL
| STACKED_SYMBOL
| STARTS_SYMBOL
| STATS_AUTO_RECALC_SYMBOL
| STATS_PERSISTENT_SYMBOL
| STATS_SAMPLE_PAGES_SYMBOL
| STATUS_SYMBOL
| STORAGE_SYMBOL
| STRING_SYMBOL
| SUBCLASS_ORIGIN_SYMBOL
| SUBDATE_SYMBOL
| SUBJECT_SYMBOL
| SUBPARTITION_SYMBOL
| SUBPARTITIONS_SYMBOL
| SUPER_SYMBOL
| SUSPEND_SYMBOL
| SWAPS_SYMBOL
| SWITCHES_SYMBOL
| TABLE_NAME_SYMBOL
| TABLES_SYMBOL
| TABLE_CHECKSUM_SYMBOL
| TABLESPACE_SYMBOL
| TEMPORARY_SYMBOL
| TEMPTABLE_SYMBOL
| TEXT_SYMBOL
| THAN_SYMBOL
| TRANSACTION_SYMBOL
| TRIGGERS_SYMBOL
| TIMESTAMP_SYMBOL
| TIMESTAMP_ADD_SYMBOL
| TIMESTAMP_DIFF_SYMBOL
| TIME_SYMBOL
| TYPES_SYMBOL
| TYPE_SYMBOL
| UDF_RETURNS_SYMBOL
| FUNCTION_SYMBOL
| UNCOMMITTED_SYMBOL
| UNDEFINED_SYMBOL
| UNDO_BUFFER_SIZE_SYMBOL
| UNDOFILE_SYMBOL
| UNKNOWN_SYMBOL
| UNTIL_SYMBOL
| USER_RESOURCES_SYMBOL
| USER_SYMBOL
| USE_FRM_SYMBOL
| VARIABLES_SYMBOL
| VIEW_SYMBOL
| VALUE_SYMBOL
| WARNINGS_SYMBOL
| WAIT_SYMBOL
| WEEK_SYMBOL
| WORK_SYMBOL
| WEIGHT_STRING_SYMBOL
| X509_SYMBOL
| XID_SYMBOL
| XML_SYMBOL
| YEAR_SYMBOL
;
finally
{
retval.start->setType(retval.start, IDENTIFIER);
}
答案 0 :(得分:0)
删除整个finally
块。设置此规则返回IDENTIFIER
的启动令牌的终端的返回类型是一种破解。但是,实际上从未检查过该类型。只有这条规则匹配的事实才是重要的。