Class IRArgument

  • All Implemented Interfaces:
    Immutable, MutationBehaviour<Immutable>
    Direct Known Subclasses:
    IRArgument.Concatenation, IRArgument.Single

    @Beta
    public abstract class IRArgument
    extends Object
    An argument to a YANG statement, as defined by section 6.1.3 of both RFC6020 and RFC7950. An argument is effectively any old string, except it can be defined in a number of ways:
    • it can be a simple unquoted string, or
    • it can be a single-quoted string, with its contents being completely preserved, or
    • it can be a double-quoted string, which defines some escaping and whitespace-stripping rules, or
    • it can be a concatenation of any number of single- or double-quoted strings

    The first three cases as covered by IRArgument.Single subclass, which exposes appropriate methods to infer how its string literal is to be interpreted. The last case is handled by IRArgument.Concatenation subclass, which exposes the constituent parts as IRArgument.Single items.

    Please note that parser implementations producing these argument representations are NOT required to retain the format of the original definition. They are free to perform quoting and concatenation transformations as long as they maintain semantic equivalence. As a matter of example, these transformations are explicitly allowed:

    • elimination of unneeded quotes, for example turning "foo" into foo
    • transformation of quotes, for example turning "foo\nbar" into 'foo&#10bar'
    • concatenation processing, for example turning 'foo' + 'bar' into foobar