| Parser Skeleton |
indexing
description: "General parsers"
library: "Gobo Eiffel Parse Library"
author: "Eric Bezault <ericb@gobosoft.com>"
copyright: "Copyright (c) 1997, Eric Bezault"
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 report_error 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 parse when it detects
-- a syntax error. 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 -- class YY_PARSER
|
Copyright © 1999, Eric
Bezault mailto:ericb@gobosoft.com http://www.gobosoft.com Last Updated: 19 March 1999 |