10.7 Empty Matching


 
Building Parsers with Java
By Steven  John  Metsker

Table of Contents
Chapter  10.   Matching Mechanics

    Content

An empty parser matches a collection of assemblies by returning the collection with no changes whatsoever. Here is the code for Empty.match() :

 public Vector match(Vector in) {      return elementClone(in); } 

The match() methods must not change the input state. An Empty parser does not consume text from an assembly, but it may alter an assembly's state by applying an assembler to it in matchAndAssemble() . The code here makes a copy to ensure that matching does not affect the input state.


   
Top


Building Parsers with Java
Building Parsers With Javaв„ў
ISBN: 0201719622
EAN: 2147483647
Year: 2000
Pages: 169

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net