Class C_comment

All Implemented Interfaces:
ICommand, ICommand.Icomment, INode, IPos.IPosable

public class C_comment extends Command implements ICommand.Icomment
A synthetic pseudo-command representing a comment that appeared immediately before a real command in a script -- not part of the SMT-LIB command grammar itself, but modeled as a real, typed ICommand.Icomment (see issue #115) rather than a generic ICommand, so execution, typed-visitor traversal, and printing all dispatch to it the same way every other command does, with no reflection-based or generic-fallback special case.

Exists so a script's comments are carried as part of its command sequence -- consistent with how a script is modeled (List<ICommand>) -- rather than as metadata bolted onto the next real command. Every real command-dispatch path already just calls command.execute(solver) on whatever the parser hands it, so this forwards itself to any solver uniformly, with no per-command-class or per-dispatch-loop code needed. See issue #42.

  • Field Details

  • Constructor Details

    • C_comment

      public C_comment(String text)
  • Method Details

    • commandName

      public String commandName()
      Description copied from class: Command
      The command name
      Specified by:
      commandName in interface ICommand
      Specified by:
      commandName in class Command
    • text

      public String text()
      Description copied from interface: ICommand.Icomment
      Returns the raw comment text (as captured from source, or as supplied directly via the public API), not yet split into per-line ;-prefixed form -- see Command.write(org.smtlib.sexpr.Printer).
      Specified by:
      text in interface ICommand.Icomment
    • execute

      public IResponse execute(ISolver solver)
      Description copied from interface: ICommand
      Executes the command on the given solver; presumes that the command type-checked successfully.
      Specified by:
      execute in interface ICommand
      Parameters:
      solver - the instance of the solver to use (note that solvers have state)
      Returns:
      the result of the command
    • accept

      public <T> T accept(IVisitor<T> v) throws IVisitor.VisitorException
      Description copied from interface: INode
      The accept method corresponding to IVisitor, to be implemented in each subclass as { return v.visit(this); }
      Specified by:
      accept in interface INode
      Type Parameters:
      T - the return type desired from the visit methods
      Parameters:
      v - the visitor class
      Returns:
      the value returned by the visit method
      Throws:
      IVisitor.VisitorException