Class PragmaHandler

java.lang.Object
com.sun.tools.corba.ee.idl.PragmaHandler
Direct Known Subclasses:
MetaPragma, NoPragma

public abstract class PragmaHandler extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    private Preprocessor
     
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    protected void
    This method is called when the parser encounters a right curly brace.
    protected String
    Get the current token.
    protected SymtabEntry
    This method, given an entry name, returns the entry with that name.
    protected String
    This method returns a string of all of the characters from the input file from the current position up to, but not including, the end-of-line character(s).
    protected String
    getUntil(char c)
    This method returns a string of all of the characters from the input file from the current position up to, but not including, the given character.
    (package private) void
     
    protected String
    This method returns the next token String from the input file.
    protected void
    This method is called when the parser encounters a left curly brace.
    protected void
    This method displays a Parser Exception complete with line number and position information with the given message string.
    abstract boolean
    process(String pragma, String currentToken)
     
    protected SymtabEntry
    This method assumes that the current token marks the beginning of a scoped name.
    protected void
    Skip to the end of the line.
    protected String
    skipUntil(char c)
    This method skips the data in the input file until the specified character is encountered, then it returns the next token.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

  • Constructor Details

    • PragmaHandler

      public PragmaHandler()
  • Method Details

    • process

      public abstract boolean process(String pragma, String currentToken) throws IOException
      Throws:
      IOException
    • init

      void init(Preprocessor p)
    • currentToken

      protected String currentToken()
      Get the current token.
      Returns:
      the current token
    • getEntryForName

      protected SymtabEntry getEntryForName(String string)
      This method, given an entry name, returns the entry with that name. It can take fully or partially qualified names and returns the appropriate entry defined within the current scope. If no entry exists, null is returned.
      Parameters:
      string - entry name to look for
      Returns:
      entry with that name or null if no entry
    • getStringToEOL

      protected String getStringToEOL() throws IOException
      This method returns a string of all of the characters from the input file from the current position up to, but not including, the end-of-line character(s).
      Returns:
      String from current position
      Throws:
      IOException
    • getUntil

      protected String getUntil(char c) throws IOException
      This method returns a string of all of the characters from the input file from the current position up to, but not including, the given character. It encapsulates parenthesis and quoted strings, meaning it does not stop if the given character is found within parentheses or quotes. For instance, given the input of `start(inside)end', getUntil ('n') will return "start(inside)e".
      Parameters:
      c - token to read up to. The token itself will not be read.
      Throws:
      IOException
    • nextToken

      protected String nextToken() throws IOException
      This method returns the next token String from the input file.
      Returns:
      the next token String
      Throws:
      IOException
    • scopedName

      protected SymtabEntry scopedName() throws IOException
      This method assumes that the current token marks the beginning of a scoped name. It then parses the subsequent identifier and double colon tokens, builds the scoped name, and finds the symbol table entry with that name.
      Returns:
      a SymtabEntry of the name
      Throws:
      IOException
    • skipToEOL

      protected void skipToEOL() throws IOException
      Skip to the end of the line.
      Throws:
      IOException
    • skipUntil

      protected String skipUntil(char c) throws IOException
      This method skips the data in the input file until the specified character is encountered, then it returns the next token.
      Parameters:
      c - token to indicate end of skipping
      Throws:
      IOException
    • parseException

      protected void parseException(String message)
      This method displays a Parser Exception complete with line number and position information with the given message string.
      Parameters:
      message - message to display as part of the Exception
      See Also:
    • openScope

      protected void openScope(SymtabEntry entry)
      This method is called when the parser encounters a left curly brace. An extender of PragmaHandler may find scope information useful. For example, the prefix pragma takes effect as soon as it is encountered and stays in effect until the current scope is closed. If a similar pragma extension is desired, then the openScope and closeScope methods are available for overriding.
      Parameters:
      entry - the symbol table entry whose scope has just been opened. Be aware that, since the scope has just been entered, this entry is incomplete at this point.
    • closeScope

      protected void closeScope(SymtabEntry entry)
      This method is called when the parser encounters a right curly brace. An extender of PragmaHandler may find scope information useful. For example, the prefix pragma takes effect as soon as it is encountered and stays in effect until the current scope is closed. If a similar pragma extension is desired, then the openScope and closeScope methods are available for overriding.
      Parameters:
      entry - the symbol table entry whose scope has just been closed.