File union.icn

Summary

union.icn - Union Object Notation (UniON) support

Authors: Gigi Young, Clinton Jeffery, Steve Wampler

The Union class is intended to support conversion of Unicon values to and from a JSON-like string format, UniON, that is suitable for storage or transmission. It draws extremely heavily from Gigi's json.icn with the major difference that it emphasizes intra-Unicon encoding and decoding of values over inter-language support for JSON syntax. For example, Unicon structures (csets, sets, tables, records, and objects) are uniquely identified as such in their UniON form.

Classes:
ErrorHandler, Union

Procedures:
_toUs, mkRef, parse_array, parse_class, parse_false, parse_null, parse_number, parse_object, parse_record, parse_ref, parse_set, parse_string, parse_table, parse_true, scan_cset, scan_ctrl_char, scan_false, scan_null, scan_number, scan_string, scan_true, union_parser, union_scanner, unionify_string

Imports:
lang, util

Links:
escape.icn

This file is part of the propertydb package.

Source code.

Details
Procedures:

_toUs(u, uerror, seen)

Parameters:
u
Unicon value to encode
uerror
Error handling support class instance

Given a Unicon structure, produce a UniON equivalent if possible. Intended for internal use only.


mkRef(u)


parse_array(token, token_gen, parse_funcs, refs, uerror)

Helper parsing function recognizes the production rules for a UniON array. Returns a Unicon list if the syntax is proper (success). Intended for internal use only.


parse_class(token, token_gen, parse_funcs, refs, uerror)

Intended for internal use only.


parse_false(token, token_gen, parse_funcs, refs, uerror)

Returns a string to represent a boolean false Intended for internal use only.


parse_null(token, token_gen, parse_funcs, refs, uerror)

Returns the null value Intended for internal use only.


parse_number(token, token_gen, parse_funcs, refs, uerror)

Returns the numeric() of the token Intended for internal use only.


parse_object(token, token_gen, parse_funcs, refs, uerror)

Helper parsing function that recognizes the production rules for a UniON object. The first token can denote that the object is a Unicon table, set, record, or class. If it doesn't then a table is assumed for backward compatibility. Intended for internal use only.


parse_record(token, token_gen, parse_funcs, refs, uerror)

Intended for internal use only.


parse_ref(token, token_gen, parse_funcs, refs, uerror)

Replace with the referenced value. Intended for internal use only.


parse_set(token, token_gen, parse_funcs, refs, uerror)

Helper parsing function recognizes the production rules for a UniON set. Returns a Unicon set if the syntax is proper (success). Intended for internal use only.


parse_string(token, token_gen, parse_funcs, refs, uerror)

Removes the delimiting double-quotes from the token. Converts to cset if there are delimiting single-quotes instead of double-quotes. Intended for internal use only.


parse_table(token, token_gen, parse_funcs, refs, uerror)

Intended for internal use only.


parse_true(token, token_gen, parse_funcs, refs, uerror)

Returns a string to represent a boolean true Intended for internal use only.


scan_cset(uerror)

Parameter:
uerror
Error handling support class instance

String scanning helper function that identifies a UniON cset and returns a Unicon cset. Intended for internal use only.


scan_ctrl_char(uerror)

Parameter:
uerror
Error handling support class instance

String scanning helper function that finds a valid UniON escape sequence and returns a valid Unicon escape or escape sequence if possible. Intended for internal use only.


scan_false(uerror)

Parameter:
uerror
Error handling support class instance

String scanning helper function to retrieve UniON value 'false' Intended for internal use only.


scan_null(uerror)

Parameter:
uerror
Error handling support class instance

String scanning helper function to retrieve UniON value 'null' Intended for internal use only.


scan_number(c, uerror)

Parameters:
c
first character in scan
uerror
Error handling support class instance

String scanning helper function that returns a UniON number as a string Intended for internal use only.


scan_string(uerror)

Parameter:
uerror
Error handling support class instance

String scanning helper function that identifies a UniON string and returns a Unicon string Intended for internal use only.


scan_true(uerror)

Parameter:
uerror
Error handling support class instance

String scanning helper function to retrieve UniON value 'true' Intended for internal use only.


union_parser(token_gen, uerror)

Parameters:
token_gen
generator of tokens from UniON string
uerror
Error handling support class instance

Takes a co-expression to generate UniON tokens. Returns a Unicon equivalent UniON structure. Intended for internal use only.


union_scanner(s, uerror)

Parameters:
s
UniON string to convert
uerror
Error handling support class instance

A string-scanning generator - takes a UniON-formatted string and returns single UniON tokens until scanning is complete Intended for internal use only.


unionify_string(s)

Parameter:
s
UniON string to fix

Handle conversions of special characters when building a UniON string. Intended for internal use only.



This page produced by UniDoc on 2021/04/15 @ 23:59:54.