lojix/logic/src/main/com/thesett/aima/logic/fol/isoprologparser/PrologParser.java
public Term atom() throws SourceCodeException
    {
        Token name = consumeToken(ATOM);

        Term result;

        // Used to build the possible set of operators that this symbol could be parsed as.
        EnumMap<OpSymbol.Fixity, OpSymbol> possibleOperators =
            operatorTable.getOperatorsMatchingNameByFixity(name.image);

        // Check if the symbol mapped onto any candidate operators and if not create a constant for it.
        if ((possibleOperators == null) || possibleOperators.isEmpty())
        {
            int nameId = interner.internFunctorName(name.image, 0);
            result = new Functor(nameId, null);
        }
        else
        {
            // Set the possible associativities of the operator on the candidate.
            result = new CandidateOpSymbol(name.image, possibleOperators);
        }

        // Set the position that the name was parsed from.
        SourceCodePosition position =
            new SourceCodePositionImpl(name.beginLine, name.beginColumn, name.endLine, name.endColumn);
        result.setSourceCodePosition(position);

        return result;
    }
public Term atom() throws SourceCodeException
    {
        Token name = consumeToken(ATOM);

        Term result;

        // Used to build the possible set of operators that this symbol could be parsed as.
        EnumMap<OpSymbol.Fixity, OpSymbol> possibleOperators =
            operatorTable.getOperatorsMatchingNameByFixity(name.image);

        // Check if the symbol mapped onto any candidate operators and if not create a constant for it.
        if ((possibleOperators == null) || possibleOperators.isEmpty())
        {
            int nameId = interner.internFunctorName(name.image, 0);
            result = new Functor(nameId, null);
        }
        else
        {
            // Set the possible associativities of the operator on the candidate.
            result = new CandidateOpSymbol(name.image, possibleOperators);
        }

        // Set the position that the name was parsed from.
        SourceCodePosition position =
            new SourceCodePositionImpl(name.beginLine, name.beginColumn, name.endLine, name.endColumn);
        result.setSourceCodePosition(position);

        return result;
    }
public Term atom ( ) throws SourceCodeException { Token name = consumeToken ( ATOM ) ; Term result ; // Used to build the possible set of operators that this symbol could be parsed as. EnumMap < OpSymbol . Fixity , OpSymbol > possibleOperators = operatorTable . getOperatorsMatchingNameByFixity ( name . image ) ; // Check if the symbol mapped onto any candidate operators and if not create a constant for it. if ( ( possibleOperators == null ) || possibleOperators . isEmpty ( ) ) { int nameId = interner . internFunctorName ( name . image , 0 ) ; result = new Functor ( nameId , null ) ; } else { // Set the possible associativities of the operator on the candidate. result = new CandidateOpSymbol ( name . image , possibleOperators ) ; } // Set the position that the name was parsed from. SourceCodePosition position = new SourceCodePositionImpl ( name . beginLine , name . beginColumn , name . endLine , name . endColumn ) ; result . setSourceCodePosition ( position ) ; return result ; }
Parses a single atom in first order logic. If the operator has been set up which has the same name as the atom
then the atom may actually be a functor expressed as a prefix, postfix or infix operator. If this is the case the
value returned by this method will be a {@link CandidateOpSymbol}. Otherwise it will be a {@link Functor} of
arity zero.

@return A {@link CandidateOpSymbol} or a {@link Functor} or arity zero.

@throws SourceCodeException If the token sequence does not parse as a valid atom.
Parses a single atom in first order logic . If the operator has been set up which has the same name as the atom then the atom may actually be a functor expressed as a prefix postfix or infix operator . If this is the case the value returned by this method will be a { @link CandidateOpSymbol } . Otherwise it will be a { @link Functor } of arity zero .