## org.eclipse.ocl.lpg
Class AbstractAnalyzer

    java.lang.Object
      org.eclipse.ocl.lpg.AbstractAnalyzer

Direct Known Subclasses:
  AbstractOCLAnalyzer

    public abstract class AbstractAnalyzer

extends Object

The `AbstractAnalyzer` supports semantic analysis of a CST produced by an `AbstractParser` to create a corresponding AST. It is necessary that syntactic parsing and semantic analysis are performed in two steps because LPG is a bottom up parser and cannot provide enough contextual information to create the AST on the first pass. Derived classes should extend the abstract support for AST from CST from tokens from text parsing and analysis to support the AST and CST classes appropriate to a particular language.

Constructor Summary
`protected` `AbstractAnalyzer(AbstractParser parser)`

Method Summary
`String` `computeInputString(CSTNode node)` Obtains the text from which the specified CST `node` was parsed.
`void` `dumpTokens()`
`void` `ERROR(List<?> problemObjects, String rule, String problemMessage)`
`void` `ERROR(Object problemObject, String rule, String problemMessage)`
`void` `ERROR(String problemMessage)`
`String` `formatClass(Object object)`
`String` `formatEClassName(EObject object)`
`String` `formatName(Object object)`
`String` `formatPath(List<String> pathName)`
`String` `formatPath(List<String> pathName, String name)`
`String` `formatQualifiedName(Object object)`
`String` `formatString(String string)`
`String` `formatType(Object object)`
`int` `getCharOffset()`
`BasicEnvironment` `getEnvironment()`
`FormattingHelper` `getFormatter()` Get the message formatting assistant, returning the value set by setFormatter, if non-null, else that provided by the enbvironment, if non-null, else AbstractFormattingHelper.INSTANCE.
`AbstractLexer` `getLexer()`
`AbstractParser` `getParser()`
`boolean` `getTraceFlag()`
`void` `initialize(char[] buffer)` Define the input text as a given array of characters.
`void` `initialize(Reader reader)` Define the input text by reading from a reader.
`protected void` `initPropertyPositions(CallingASTNode callingASTNode, CSTNode cstNode)` Initializes the start and end positions of the property name in the specified calling AST node.
`protected void` `initStartEndPositions(ASTNode astNode, CSTNode cstNode)` Initializes the start and end positions of the specified AST node from the given CST node
`protected void` `initTypePositions(TypedASTNode typedASTNode, CSTNode cstNode)` Initializes the type start and end positions of the specified typed AST node from the given CST node
`protected String` `makeName(EList<String> namelist)` Creates a string by joining the given string list elements with ::.
`protected String` `makeString(EList<String> namelist)` Creates a string by joining the given string list elements with spaces.
`void` `setCharacterOffset(int offset)` Sets the character index offset of the input.
`void` `setFileName(String filename)`
`void` `setTab(int tab)`
`void` `setTraceFlag(boolean flag)`
`protected void` `TRACE(String rule, String message)`
`protected void` `TRACE(String rule, String message, EList<String> namelist)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### AbstractAnalyzer

    protected AbstractAnalyzer(AbstractParser parser)

Method Detail

### computeInputString

    public String computeInputString(CSTNode node)

  Obtains the text from which the specified CST `node` was parsed.

  Parameters:
    `node` - a concrete syntax node
  Returns:
    its text

### dumpTokens

    public void dumpTokens()

### formatClass

    public String formatClass(Object object)

### formatEClassName

    public String formatEClassName(EObject object)

### formatName

    public String formatName(Object object)

### formatQualifiedName

    public String formatQualifiedName(Object object)

### formatPath

    public String formatPath(List<String> pathName)

### formatPath

    public String formatPath(List<String> pathName,
                             String name)

### formatString

    public String formatString(String string)

### formatType

    public String formatType(Object object)

### getCharOffset

    public int getCharOffset()

### getEnvironment

    public BasicEnvironment getEnvironment()

### getFormatter

    public FormattingHelper getFormatter()

  Get the message formatting assistant, returning the value set by setFormatter, if non-null, else that provided by the enbvironment, if non-null, else AbstractFormattingHelper.INSTANCE.

  Returns:
    A non-null message formatting helper

### getLexer

    public AbstractLexer getLexer()

### getParser

    public AbstractParser getParser()

### getTraceFlag

    public boolean getTraceFlag()

### initPropertyPositions

    protected void initPropertyPositions(CallingASTNode callingASTNode,
                                         CSTNode cstNode)

  Initializes the start and end positions of the property name in the specified calling AST node.

  Parameters:
    `callingASTNode` - a calling AST node
    `cstNode` - a CST node

### initStartEndPositions

    protected void initStartEndPositions(ASTNode astNode,
                                         CSTNode cstNode)

  Initializes the start and end positions of the specified AST node from the given CST node

  Parameters:
    `astNode` - an AST node
    `cstNode` - a CST node

### initTypePositions

    protected void initTypePositions(TypedASTNode typedASTNode,
                                     CSTNode cstNode)

  Initializes the type start and end positions of the specified typed AST node from the given CST node

  Parameters:
    `typedASTNode` - a typed AST node
    `cstNode` - a CST node

### makeName

    protected String makeName(EList<String> namelist)

  Creates a string by joining the given string list elements with ::.

  Parameters:
    `namelist` - list of names to make string out of
  Returns:
    the qualified name comprising the list of name elements

### makeString

    protected String makeString(EList<String> namelist)

  Creates a string by joining the given string list elements with spaces.

  Parameters:
    `namelist` - list of names to make string out of
  Returns:
    string representation of the list of string elements

### setCharacterOffset

    public void setCharacterOffset(int offset)

  Sets the character index offset of the input.

  Parameters:
    `offset` -

### setFileName

    public void setFileName(String filename)

### initialize

    public void initialize(char[] buffer)

  Define the input text as a given array of characters.

  Parameters:
    `buffer` - the characters

### initialize

    public void initialize(Reader reader)
                    throws IOException

  Define the input text by reading from a reader.

  Parameters:
    `reader` - providing the source text
  Throws:
    `IOException` - if reading fails

### setTab

    public void setTab(int tab)

### setTraceFlag

    public void setTraceFlag(boolean flag)

### ERROR

    public void ERROR(String problemMessage)

### ERROR

    public void ERROR(Object problemObject,
                      String rule,
                      String problemMessage)

### ERROR

    public void ERROR(List<?> problemObjects,
                      String rule,
                      String problemMessage)

### TRACE

    protected void TRACE(String rule,
                         String message)

### TRACE

    protected void TRACE(String rule,
                         String message,
                         EList<String> namelist)

Copyright 2002, 2007 IBM Corporation and others. All Rights Reserved.