parser_util (library)

Author(s): Göran Smedbäck.

Documentation on exports

PREDICATE

Usage:at_least_one(ParseIn,ParseOut,L,T)

One or more whitespace or comment have to be read, for the moment there are no whitespaces to be read so we only stick with the comments.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
    (basic_props:list/1)L is a list.
    (basic_props:list/1)T is a list.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:at_least_one(ParseIn,ParseOut,ListOfRead,L,T)

One or more whitespace or comment have to be read, the result will be given in the list.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
    (basic_props:list/2)ListOfRead is a list of terms.
    (basic_props:list/1)L is a list.
    (basic_props:list/1)T is a list.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.
    (term_typing:var/1)ListOfRead is a free variable.

PREDICATE

Usage:fillout(ParseIn,ParseOut,L,T)

If there are whitespaces and comments, zero or more of each. This read all comments and all whitespace. The comments and whitespace will not be returned.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
    (basic_props:list/1)L is a list.
    (basic_props:list/1)T is a list.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:fillout(ParseIn,ParseOut,ResultingList,L,T)

If there are whitespaces and comments, zero or more of each, we add them to the resulting list. This read all comments and all whitespace.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
    (basic_props:list/2)ResultingList is a list of terms.
    (basic_props:list/1)L is a list.
    (basic_props:list/1)T is a list.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.
    (term_typing:var/1)ResultingList is a free variable.

PREDICATE

Usage:create_node(NodeTypeId,Parse,Node)

The predicate will construct a node term with the read guts which is inside the parse structure. A node consists of its name and one argument, a list of its fields.

  • Call and exit should be compatible with:
    (basic_props:atm/1)NodeTypeId is an atom.
    (internal_types:parse/1)Parse is a parse structure.
    (basic_props:term/1)Node is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)NodeTypeId is currently a term which is not a free variable.
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:var/1)Node is a free variable.

PREDICATE

Usage:create_field(FieldNameId,Arguments,Field)

The predicate will construct a field with the Id as the fieldname and the arguments as they are, in a double list, which results in a single list or a single list which will result in free arguments.

  • Call and exit should be compatible with:
    (basic_props:atm/1)FieldNameId is an atom.
    (basic_props:term/1)Arguments is any term.
    (basic_props:term/1)Field is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)FieldNameId is currently a term which is not a free variable.
    (term_typing:nonvar/1)Arguments is currently a term which is not a free variable.
    (term_typing:var/1)Field is a free variable.

PREDICATE

Usage:create_field(FieldAccess,FieldType,FieldId,Field)

The predicate will construct a field with its access type as the name with type and id as arguments.

  • Call and exit should be compatible with:
    (basic_props:atm/1)FieldAccess is an atom.
    (basic_props:atm/1)FieldType is an atom.
    (basic_props:atm/1)FieldId is an atom.
    (basic_props:term/1)Field is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)FieldAccess is currently a term which is not a free variable.
    (term_typing:nonvar/1)FieldType is currently a term which is not a free variable.
    (term_typing:nonvar/1)FieldId is currently a term which is not a free variable.
    (term_typing:var/1)Field is a free variable.

PREDICATE

Usage:create_field(FieldAccess,FieldType,FieldId,Fieldvalue,Field)

The predicate will construct a field with its access type as the name with type, id and value as arguments.

  • Call and exit should be compatible with:
    (basic_props:atm/1)FieldAccess is an atom.
    (basic_props:atm/1)FieldType is an atom.
    (basic_props:atm/1)FieldId is an atom.
    (basic_props:term/1)Fieldvalue is any term.
    (basic_props:term/1)Field is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)FieldAccess is currently a term which is not a free variable.
    (term_typing:nonvar/1)FieldType is currently a term which is not a free variable.
    (term_typing:nonvar/1)FieldId is currently a term which is not a free variable.
    (term_typing:nonvar/1)Fieldvalue is currently a term which is not a free variable.
    (term_typing:var/1)Field is a free variable.

PREDICATE

Usage:create_directed_field(Access,Type,Id0,Id1,Field)

The predicate will construct a directed field with the key word IS in the middle. Its access type as the name with type, from id0 and to id1 as arguments.

  • Call and exit should be compatible with:
    (basic_props:atm/1)Access is an atom.
    (basic_props:atm/1)Type is an atom.
    (basic_props:atm/1)Id0 is an atom.
    (basic_props:atm/1)Id1 is an atom.
    (basic_props:term/1)Field is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Access is currently a term which is not a free variable.
    (term_typing:nonvar/1)Type is currently a term which is not a free variable.
    (term_typing:nonvar/1)Id0 is currently a term which is not a free variable.
    (term_typing:nonvar/1)Id1 is currently a term which is not a free variable.
    (term_typing:var/1)Field is a free variable.

PREDICATE

Usage:correct_commenting(Place,Comment,ParsedIn,ParsedOut)

The predicate places the comment 'before' or 'after' the parsed term. This results in a list with the term and the comment or in just returning the term.

  • Call and exit should be compatible with:
    (basic_props:atm/1)Place is an atom.
    (basic_props:struct/1)Comment is a compound term.
    (basic_props:term/1)ParsedIn is any term.
    (basic_props:term/1)ParsedOut is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Place is currently a term which is not a free variable.
    (term_typing:nonvar/1)Comment is currently a term which is not a free variable.
    (term_typing:nonvar/1)ParsedIn is currently a term which is not a free variable.
    (term_typing:var/1)ParsedOut is a free variable.

PREDICATE

Usage:create_parse_structure(Parse)

The predicate will construct the parse structure with its three fields: the parsing list, the environment structure, and the dictionaries.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
  • The following properties should hold at call time:
    (term_typing:var/1)Parse is a free variable.

PREDICATE

Usage 1:create_parse_structure(ParseIn,ParseOut)

The predicate will construct a parse structure with its three fields: the parsing list, the environment structure, and the dictionaries. It will reuse the environment and the dictionaries from the input.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

Usage 2:create_parse_structure(ParsedList,ParseOut)

The predicate will construct a parse structure with its three fields: the parsing list, the environment structure, and the dictionaries. It will use the list of parsed items in its structure.

  • Call and exit should be compatible with:
    (basic_props:list/2)ParsedList is a list of terms.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParsedList is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:create_parse_structure(ParsedList,ParseIn,ParseOut)

The predicate will construct a parse structure with its three fields: the parsing list, the environment structure, and the dictionaries. It will use the list of parsed items in its structure and the environment and the dictionary from the parse structure given.

  • Call and exit should be compatible with:
    (basic_props:list/2)ParsedList is a list of terms.
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParsedList is currently a term which is not a free variable.
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:create_environment(Parse,EnvType,Name,EnvStruct)

The predicate will construct an environment structure based on the information in the parse structure. Well only the white- space information will be reused. The are three types of environments 'PROTO', 'EXTERNPROTO', and 'DEF'.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
    (basic_props:atm/1)EnvType is an atom.
    (basic_props:atm/1)Name is an atom.
    (internal_types:environment/1)EnvStruct is an environment structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:nonvar/1)EnvType is currently a term which is not a free variable.
    (term_typing:nonvar/1)Name is currently a term which is not a free variable.
    (term_typing:var/1)EnvStruct is a free variable.

PREDICATE

Usage:insert_comments_in_beginning(Comment,ParseIn,ParseOut)

We add the comment in the beginneing of the parsed, to get the proper look.

  • Call and exit should be compatible with:
    (basic_props:struct/1)Comment is a compound term.
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Comment is currently a term which is not a free variable.
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:get_environment_name(Environment,Name)

The predicate will return the enviroment name.

  • Call and exit should be compatible with:
    (internal_types:environment/1)Environment is an environment structure.
    (basic_props:atm/1)Name is an atom.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Environment is currently a term which is not a free variable.
    (term_typing:var/1)Name is a free variable.

PREDICATE

Usage:get_environment_type(Environment,Type)

The predicate will return the enviroment type, one of the three: 'PROTO', 'EXTERNPROTO', and 'DEF'.

  • Call and exit should be compatible with:
    (internal_types:environment/1)Environment is an environment structure.
    (basic_props:atm/1)Type is an atom.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Environment is currently a term which is not a free variable.
    (term_typing:var/1)Type is a free variable.

PREDICATE

Usage:get_row_number(Parse,Row)

The predicate will return the row number from the parse structure. The row number is not fully implemented.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
    (basic_props:num/1)Row is a number.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:var/1)Row is a free variable.

PREDICATE

Usage:add_environment_whitespace(EnvIn,WhiteSpaceList,EnvOut)

The predicate will add the new whitespace that is collected in a list of whitespaces to the environment.

  • Call and exit should be compatible with:
    (internal_types:environment/1)EnvIn is an environment structure.
    (basic_props:list/2)WhiteSpaceList is a list of atms.
    (internal_types:environment/1)EnvOut is an environment structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)EnvIn is currently a term which is not a free variable.
    (term_typing:nonvar/1)WhiteSpaceList is currently a term which is not a free variable.
    (term_typing:var/1)EnvOut is a free variable.

PREDICATE

Usage 1:get_indentation(Whitespace,Indentation)

The predicate will return the indentation depth from a whitespace structure.

  • Call and exit should be compatible with:
    (internal_types:whitespace/1)Whitespace is a whitespace structure.
    (basic_props:num/1)Indentation is a number.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Whitespace is currently a term which is not a free variable.
    (term_typing:var/1)Indentation is a free variable.

Usage 2:get_indentation(Parse,Indentation)

The predicate will return the indentation depth from a parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
    (basic_props:num/1)Indentation is a number.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:var/1)Indentation is a free variable.

PREDICATE

Usage:inc_indentation(ParseIn,ParseOut)

Will increase the indentation with one step to a parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:dec_indentation(ParseIn,ParseOut)

Will decrease the indentation with one step to a parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE
No further documentation available for this predicate.

PREDICATE
No further documentation available for this predicate.

PREDICATE

Usage:push_whitespace(ParseWithWhitespace,ParseIn,ParseOut)

The predicate will add the whitespace values from one parse structure to another one, resultin in the output, with the values from the second parse structure with the whitespace from the first added.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseWithWhitespace is a parse structure.
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseWithWhitespace is currently a term which is not a free variable.
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:push_dictionaries(Parse,Parse,Parse)

The predicate will set the first parse structure's directory to the second parsing structure argument. The resulting parsing structure will be returned.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
    (internal_types:parse/1)Parse is a parse structure.
    (internal_types:parse/1)Parse is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:var/1)Parse is a free variable.

PREDICATE

Usage 1:get_parsed(ParseStructure,ListOfParsed)

The predicate will return a list of the parsed terms that is inside the parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseStructure is a parse structure.
    (basic_props:list/2)ListOfParsed is a list of terms.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseStructure is currently a term which is not a free variable.
    (term_typing:var/1)ListOfParsed is a free variable.

Usage 2:get_parsed(ParseStructure,EnvironmentStructure)

The predicate will return the environment of the parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseStructure is a parse structure.
    (internal_types:environment/1)EnvironmentStructure is an environment structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseStructure is currently a term which is not a free variable.
    (term_typing:var/1)EnvironmentStructure is a free variable.

Usage 3:get_parsed(ParseStructure,Dictionaries)

The predicate will return dictionary used within the parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseStructure is a parse structure.
    (internal_types:dictionary/1)Dictionaries is a dictionary.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseStructure is currently a term which is not a free variable.
    (term_typing:var/1)Dictionaries is a free variable.

PREDICATE
No further documentation available for this predicate.

PREDICATE

Usage:inside_proto(Parse)

The predicate will answer to the question: are we parsing inside a PROTO/EXTERNPROTO.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.

PREDICATE
No further documentation available for this predicate.

PREDICATE

Usage:strip_from_list(ListWithComments,CleanList)

The predicate will strip the list from comments and return a list without any comments.

  • Call and exit should be compatible with:
    (basic_props:list/2)ListWithComments is a list of terms.
    (basic_props:list/2)CleanList is a list of terms.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ListWithComments is currently a term which is not a free variable.
    (term_typing:var/1)CleanList is a free variable.

PREDICATE

Usage:strip_from_term(Term,Stripped)

The predicate will remove comments from a term, it will reduce its arguments if there are comments as arguments.

  • Call and exit should be compatible with:
    (basic_props:term/1)Term is any term.
    (basic_props:term/1)Stripped is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Term is currently a term which is not a free variable.
    (term_typing:var/1)Stripped is a free variable.

PREDICATE

Usage:strip_clean(ParsedIn,ParsedOut)

The predicate will return a striped list or a single atom if there was no comments and no more items in the list. It will also return a atom if there is comments and only one other element.

  • Call and exit should be compatible with:
    (basic_props:term/1)ParsedIn is any term.
    (basic_props:term/1)ParsedOut is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParsedIn is currently a term which is not a free variable.
    (term_typing:var/1)ParsedOut is a free variable.

PREDICATE
No further documentation available for this predicate.

PREDICATE
No further documentation available for this predicate.

PREDICATE

Usage:strip_interface(Interface,StrippedInterface)

The predicate will remove comments from the interface that we read for the PROTOtype. This will help us when setting the properties.

  • Call and exit should be compatible with:
    (basic_props:list/2)Interface is a list of terms.
    (basic_props:list/2)StrippedInterface is a list of terms.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Interface is currently a term which is not a free variable.
    (term_typing:var/1)StrippedInterface is a free variable.

PREDICATE

Usage:set_parsed(ParseIn,NewParseList,ParseOut)

The predicate will create a new parse structure from the first parse structure with the parse list from the second argument.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (basic_props:list/2)NewParseList is a list of terms.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:nonvar/1)NewParseList is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:set_environment(Environment,ParseIn,ParseOut)

The modificator will return a parse structure with the environment given with the other properties from the first parse structure.

  • Call and exit should be compatible with:
    (internal_types:environment/1)Environment is an environment structure.
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Environment is currently a term which is not a free variable.
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:insert_parsed(ListOfParsed,ParseIn,ParseOut)

The predicate will append the newly parsed terms to the old that we have in the parse structure.

  • Call and exit should be compatible with:
    (basic_props:list/2)ListOfParsed is a list of terms.
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ListOfParsed is currently a term which is not a free variable.
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:reverse_parsed(ParseIn,ParseOut)

The returned parse structure is the same as the input with the difference that the parsed terms are in reverse order.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.

PREDICATE

Usage:stop_parse(TermIn,TermOut)

The predicate will bind the invalue to the outvalue, used to terminate a parsing.

  • Call and exit should be compatible with:
    (basic_props:term/1)TermIn is any term.
    (basic_props:term/1)TermOut is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)TermIn is currently a term which is not a free variable.
    (term_typing:var/1)TermOut is a free variable.

PREDICATE

Usage:look_first_parsed(Parse,First)

Look at the first item in the parse structure.

  • Call and exit should be compatible with:
    (internal_types:parse/1)Parse is a parse structure.
    (basic_props:term/1)First is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Parse is currently a term which is not a free variable.
    (term_typing:var/1)First is a free variable.

PREDICATE

Usage:get_first_parsed(ParseIn,ParseOut,First)

Get the first item in the parse structure and return the parse structure with the item removed.

  • Call and exit should be compatible with:
    (internal_types:parse/1)ParseIn is a parse structure.
    (internal_types:parse/1)ParseOut is a parse structure.
    (basic_props:term/1)First is any term.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)ParseIn is currently a term which is not a free variable.
    (term_typing:var/1)ParseOut is a free variable.
    (term_typing:var/1)First is a free variable.

PREDICATE
No further documentation available for this predicate.

PREDICATE

Usage:look_ahead(Name,Parsed,Parsed)

This predicate is used normally by the CDG and the two last arguments will therefore be the same because we don't remove the parsed. The name is the name inside a term, the first argument.

  • Call and exit should be compatible with:
    (basic_props:atm/1)Name is an atom.
    (basic_props:list/2)Parsed is a list of terms.
    (basic_props:list/2)Parsed is a list of terms.
  • The following properties should hold at call time:
    (term_typing:nonvar/1)Name is currently a term which is not a free variable.
    (term_typing:nonvar/1)Parsed is currently a term which is not a free variable.
    (term_typing:var/1)Parsed is a free variable.