| Parser Skeleton |
indexing
description: "General parsers"
library: "Gobo Eiffel Parse Library"
copyright: "Copyright (c) 1999-2003, Eric Bezault and others"
license: "Eiffel Forum License v2 (see forum.txt)"
deferred class YY_PARSER [G]
creation
make
-- Create a new parser.
feature -- Parsing
parse
-- Parse input stream.
-- Set syntax_error to True if
-- parsing has not been successful.
feature -- Status report
syntax_error: BOOLEAN
-- Has last parsing been unsuccesful?
feature -- Access
error_count: INTEGER
-- Number of errors detected during last parsing
-- (error_count can be non-zero even though
-- syntax_error is false. This can happen when
-- error recovery occurred.)
ensure
error_count_non_negative: Result >= 0
feature -- Element change
clear_all
-- Clear temporary objects so that they can be collected
-- by the garbage collector. (This routine is called by
-- parse before exiting. It can be redefined in descendants.)
feature {YY_PARSER_ACTION} -- Status report
is_recovering: BOOLEAN
-- Is current parser recovering from a syntax error?
feature {YY_PARSER_ACTION} -- Basic operations
accept
-- Stop parsing successfully.
ensure
accepted: not syntax_error
abort
-- Abort parsing.
-- Do not print error message.
ensure
aborted: syntax_error
raise_error
-- Raise a syntax error.
-- Report error using the error action %error associated
-- with current parsing state or report_error by default,
-- and perform normal error recovery if possible.
recover
-- Recover immediately after a parse error.
report_error (a_message: STRING)
-- Print error message.
-- (This routine is called by default by parse when it
-- detects a syntax error and there is no error action
-- %error available. It can be redefined in descendants.)
require
a_message_not_void: a_message /= Void
clear_token
-- Clear the previous lookahead token.
-- Used in error-recovery rule actions.
feature {YY_PARSER_ACTION} -- Scanning
read_token
-- Read a token from input stream.
-- Make result available in last_token.
-- (This routine is called by parse when it needs a
-- new token from the input stream.)
last_token: INTEGER
-- Last token read
last_value: G
-- Semantic value of last token read
end
|
Copyright © 1999-2003, Eric
Bezault and others mailto:ericb@gobosoft.com http://www.gobosoft.com Last Updated: 9 March 2003 |