| Parser Skeleton |
note
description: "General parsers"
library: "Gobo Eiffel Parse Library"
copyright: "Copyright (c) 1999-2005, Eric Bezault and others"
license: "MIT License"
deferred class YY_PARSER [G]
create
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?
is_suspended: BOOLEAN
-- Has parsing been suspended?
-- The next call to parse will resume parsing in the state
-- where the parser was when it was suspended. Note that a call
-- to abort or accept will force parse to parse from scratch.
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 -- Basic operations
accept
-- Stop parsing successfully.
ensure
accepted: not syntax_error
abort
-- Abort parsing.
-- Do not print error message.
ensure
aborted: syntax_error
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} -- Basic operations
suspend
-- Suspend parsing.
-- The next call to parse will resume parsing in the state
-- where the parser was when it was suspended. Note that a call
-- to abort or accept will force parse to parse from scratch.
ensure
suspended: is_suspended
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} -- Status report
is_recovering: BOOLEAN
-- Is current parser recovering from a syntax error?
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-2005, Eric
Bezault and others mailto:ericb@gobosoft.com http://www.gobosoft.com Last Updated: 29 October 2005 |