/** * Parses a single functor in first order logic with its arguments. * * @return A single functor in first order logic with its arguments. * * @throws SourceCodeException If the token sequence does not parse as a valid functor. */ public Term functor() throws SourceCodeException { Token name = consumeToken(FUNCTOR); Term[] args = arglist(); consumeToken(RPAREN); int nameId = interner.internFunctorName((args == null) ? name.image : name.image.substring(0, name.image.length() - 1), (args == null) ? 0 : args.length); Functor result = new Functor(nameId, args); SourceCodePosition position = new SourceCodePositionImpl(name.beginLine, name.beginColumn, name.endLine, name.endColumn); result.setSourceCodePosition(position); return result; }
/** * Parses a single functor in first order logic with its arguments. * * @return A single functor in first order logic with its arguments. * * @throws SourceCodeException If the token sequence does not parse as a valid functor. */ public Functor functor() throws SourceCodeException { Token name = consumeToken(FUNCTOR); Term[] args = arglist(); consumeToken(RPAREN); int nameId = interner.internFunctorName((args == null) ? name.image : name.image.substring(0, name.image.length() - 1), (args == null) ? 0 : args.length); Functor result = new Functor(nameId, args); SourceCodePosition position = new SourceCodePositionImpl(name.beginLine, name.beginColumn, name.endLine, name.endColumn); result.setSourceCodePosition(position); return result; }