fri.patterns.interpreter.parsergenerator.semantics
Class PrintSemantic

java.lang.Object
  |
  +--fri.patterns.interpreter.parsergenerator.semantics.PrintSemantic
All Implemented Interfaces:
Semantic

public class PrintSemantic
extends java.lang.Object
implements Semantic

Simple test semantic that outputs the rule nonterminal on left side and its parsed values.

Author:
(c) 2000, Fritz Ritzberger

Constructor Summary
PrintSemantic()
           
 
Method Summary
 java.lang.Object doSemantic(Rule rule, java.util.List inputTokens, java.util.List ranges)
          Called by every REDUCE step.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PrintSemantic

public PrintSemantic()
Method Detail

doSemantic

public java.lang.Object doSemantic(Rule rule,
                                   java.util.List inputTokens,
                                   java.util.List ranges)
Description copied from interface: Semantic
Called by every REDUCE step. Passes the evaluated Rule and the corresponding parsing results.

Specified by:
doSemantic in interface Semantic
Parameters:
rule - Rule that was "reduced" (recognized).
inputTokens - all semantic call returns from underlying rules, collected according to current rule, that means you get a List of Objects as long as the count of symbols on the right side of the rule, every Object is a return of an underlying doSemantic() call.
ranges - all line ranges for parseResults elements. Cast elements to Token.Range to get the start and end position of every Object in parseResult List.
Returns:
some result to be pushed on value stack by the Parser, or null.