From 69e01855addb7aea8c502843fc309c171a9702db Mon Sep 17 00:00:00 2001 From: jeswr Date: Fri, 23 Jun 2023 09:08:28 +0000 Subject: [PATCH] deploy: 075e606cb76463a2e1617fe7e4c6ff390cb7ec4c --- docs/N3Lexer.html | 204 ++++++++++++++--------- docs/N3Parser.html | 395 ++++++++++++++++++++++++++------------------- 2 files changed, 354 insertions(+), 245 deletions(-) diff --git a/docs/N3Lexer.html b/docs/N3Lexer.html index 05faf46d..b8c395a4 100644 --- a/docs/N3Lexer.html +++ b/docs/N3Lexer.html @@ -946,13 +946,67 @@

case ']': case '(': case ')': - case '{': case '}': if (!this._lineMode) { matchLength = 1; type = firstChar; } break; + case '{': + + + + +
  • +
    + +
    + § +
    +

    We need at least 2 tokens lookahead to distinguish “{|” and “{ “

    + +
    + +
            if (!this._lineMode && input.length >= 2) {
    + +
  • + + +
  • +
    + +
    + § +
    +

    Try to find a quoted triple annotation start

    + +
    + +
              if (input[1] === '|')
    +            type = '{|', matchLength = 2;
    +          else
    +            type = firstChar, matchLength = 1;
    +        }
    +        break;
    +      case '|':
    + +
  • + + +
  • +
    + +
    + § +
    +

    We need 2 tokens lookahead to parse “|}” +Try to find a quoted triple annotation end

    + +
    + +
            if (input.length >= 2 && input[1] === '}')
    +          type = '|}', matchLength = 2;
    +        break;
     
           default:
             inconclusive = true;
    @@ -961,11 +1015,11 @@ 

    +
  • - § + §

    Some first characters do not allow an immediate decision, so inspect more

    @@ -976,11 +1030,11 @@

    +
  • - § + §

    Try to find a prefix

    @@ -993,11 +1047,11 @@

    +
  • - § + §

    Try to find a prefixed name. Since it can contain (but not end with) a dot, we always need a non-dot character before deciding it is a prefixed name. @@ -1013,11 +1067,11 @@

    +
  • - § + §

    A type token is special: it can only be emitted after an IRI or prefixed name is read

    @@ -1034,11 +1088,11 @@

    +
  • - § + §

    What if nothing of the above was found?

    @@ -1049,11 +1103,11 @@

    +
  • - § + §

    We could be in streaming mode, and then we just wait for more input to arrive. Otherwise, a syntax error has occurred in the input. @@ -1070,11 +1124,11 @@

    +
  • - § + §

    Emit the parsed token

    @@ -1088,11 +1142,11 @@

    +
  • - § + §

    Advance to next part to tokenize

    @@ -1104,11 +1158,11 @@

    +
  • - § + §

    Emits the token through the callback

    @@ -1125,11 +1179,11 @@

    +
  • - § + §

    Signals the syntax error through the callback

    @@ -1141,11 +1195,11 @@

    +
  • - § + §

    _unescape replaces N3 escape codes by their corresponding characters

    @@ -1158,11 +1212,11 @@

    -
  • +
  • - § + §

    4-digit unicode character

    @@ -1174,11 +1228,11 @@

    -
  • +
  • - § + §

    8-digit unicode character

    @@ -1193,11 +1247,11 @@

    -
  • +
  • - § + §

    fixed escape sequence

    @@ -1209,11 +1263,11 @@

    -
  • +
  • - § + §

    invalid escape sequence

    @@ -1228,11 +1282,11 @@

    -
  • +
  • - § + §

    _parseLiteral parses a literal into an unescaped value

    @@ -1243,11 +1297,11 @@

    _parseLite

  • -
  • +
  • - § + §

    Ensure we have enough lookahead to identify triple-quoted strings

    @@ -1258,11 +1312,11 @@

    _parseLite

  • -
  • +
  • - § + §

    Identify the opening quote(s)

    @@ -1274,11 +1328,11 @@

    _parseLite

  • -
  • +
  • - § + §

    Find the next candidate closing quotes

    @@ -1290,11 +1344,11 @@

    _parseLite

  • -
  • +
  • - § + §

    Count backslashes right before the closing quotes

    @@ -1307,11 +1361,11 @@

    _parseLite

  • -
  • +
  • - § + §

    An even number of backslashes (in particular 0) means these are actual, non-escaped closing quotes

    @@ -1323,11 +1377,11 @@

    _parseLite

  • -
  • +
  • - § + §

    Extract and unescape the value

    @@ -1340,11 +1394,11 @@

    _parseLite

  • -
  • +
  • - § + §

    Only triple-quoted strings can be multi-line

    @@ -1366,11 +1420,11 @@

    _parseLite

  • -
  • +
  • - § + §

    _syntaxError creates a syntax error for the given issue

    @@ -1390,11 +1444,11 @@

    _syntaxEr

  • -
  • +
  • - § + §

    Strips off any starting UTF BOM mark.

    @@ -1407,11 +1461,11 @@

    Strips off any starting UTF BOM ma

  • -
  • +
  • - § + §

    Public methods

    @@ -1420,11 +1474,11 @@

    Public methods

  • -
  • +
  • - § + §

    tokenize starts the transformation of an N3 document into an array of tokens.

    The input can be a string or a stream.

    @@ -1437,11 +1491,11 @@

    +
  • - § + §

    If the input is a string, continuously emit tokens through the callback until the end

    @@ -1453,11 +1507,11 @@

    +
  • - § + §

    If a callback was passed, asynchronously call it

    @@ -1469,11 +1523,11 @@

    +
  • - § + §

    If no callback was passed, tokenize synchronously and return

    @@ -1491,11 +1545,11 @@

    +
  • - § + §

    Otherwise, the input must be a stream

    @@ -1509,11 +1563,11 @@

    +
  • - § + §

    Adds the data chunk to the buffer and parses as far as possible

    @@ -1525,11 +1579,11 @@

    +
  • - § + §

    Prepend any previous pending writes

    @@ -1543,11 +1597,11 @@

    +
  • - § + §

    Hold if the buffer ends in an incomplete unicode sequence

    @@ -1560,11 +1614,11 @@

    +
  • - § + §

    Otherwise, tokenize as far as possible

    @@ -1575,11 +1629,11 @@

    +
  • - § + §

    Only read a BOM at the start

    @@ -1597,11 +1651,11 @@

    +
  • - § + §

    Parses until the end

    diff --git a/docs/N3Parser.html b/docs/N3Parser.html index 7af44b99..1304c1d0 100644 --- a/docs/N3Parser.html +++ b/docs/N3Parser.html @@ -2124,8 +2124,7 @@

    _r
        case ',':
           next = this._readObject;
    -      break;
    -    default:
    + break;

  • @@ -2136,6 +2135,62 @@

    _r
    §
    +

    {| means that the current triple is annotated with predicate-object pairs.

    + + + +
        case '{|':
    +      if (!this._supportsRDFStar)
    +        return this._error('Unexpected RDF* syntax', token);
    + + + + +
  • +
    + +
    + § +
    +

    Continue using the last triple as quoted triple subject for the predicate-object pairs.

    + +
    + +
          const predicate = this._predicate, object = this._object;
    +      this._subject = this._quad(subject, predicate, object, this.DEFAULTGRAPH);
    +      next = this._readPredicate;
    +      break;
    + +
  • + + +
  • +
    + +
    + § +
    +

    |} means that the current quoted triple in annotation syntax is finalized.

    + +
    + +
        case '|}':
    +      if (this._subject.termType !== 'Quad')
    +        return this._error('Unexpected asserted triple closing', token);
    +      this._subject = null;
    +      next = this._readPunctuation;
    +      break;
    +    default:
    + +
  • + + +
  • +
    + +
    + § +

    An entity means this is a quad (only allowed if not already inside a graph)

    @@ -2150,11 +2205,11 @@

    _r

  • -
  • +
  • - § + §

    A quad has been completed now, so return it

    @@ -2173,11 +2228,11 @@

    _r

  • -
  • +
  • - § + §

    _readBlankNodePunctuation reads punctuation in a blank node

    @@ -2190,11 +2245,11 @@

    _read

  • -
  • +
  • - § + §

    Semicolon means the subject is shared; predicate and object are different

    @@ -2207,11 +2262,11 @@

    _read

  • -
  • +
  • - § + §

    Comma means both the subject and predicate are shared; the object is different

    @@ -2227,11 +2282,11 @@

    _read

  • -
  • +
  • - § + §

    A quad has been completed now, so return it

    @@ -2244,11 +2299,11 @@

    _read

  • -
  • +
  • - § + §

    _readQuadPunctuation reads punctuation after a quad

    @@ -2263,11 +2318,11 @@

    _readQuadPunc

  • -
  • +
  • - § + §

    _readPrefix reads the prefix of a prefix declaration

    @@ -2283,11 +2338,11 @@

    _readPrefix<

  • -
  • +
  • - § + §

    _readPrefixIRI reads the IRI of a prefix declaration

    @@ -2305,11 +2360,11 @@

    _readPrefixI

  • -
  • +
  • - § + §

    _readBaseIRI reads the IRI of a base declaration

    @@ -2326,11 +2381,11 @@

    _readBaseIRI -
  • +
  • - § + §

    _readNamedGraphLabel reads the label of a named graph

    @@ -2352,11 +2407,11 @@

    _readNamedG

  • -
  • +
  • - § + §

    _readNamedGraphLabel reads a blank node label of a named graph

    @@ -2372,11 +2427,11 @@

    _r

  • -
  • +
  • - § + §

    _readDeclarationPunctuation reads the punctuation of a declaration

    @@ -2387,11 +2442,11 @@

    -
  • +
  • - § + §

    SPARQL-style declarations don’t have punctuation

    @@ -2410,11 +2465,11 @@

    -
  • +
  • - § + §

    Reads a list of quantified symbols from a @forSome or @forAll statement

    @@ -2434,11 +2489,11 @@

    -
  • +
  • - § + §

    Without explicit quantifiers, map entities to a quantified entity

    @@ -2450,11 +2505,11 @@

    -
  • +
  • - § + §

    With explicit quantifiers, output the reified quantifier

    @@ -2465,11 +2520,11 @@

    -
  • +
  • - § + §

    If this is the first item, start a new quantifier list

    @@ -2482,11 +2537,11 @@

    -
  • +
  • - § + §

    Otherwise, continue the previous list

    @@ -2499,11 +2554,11 @@

    -
  • +
  • - § + §

    Output the list item

    @@ -2517,11 +2572,11 @@

    -
  • +
  • - § + §

    Reads punctuation from a @forSome or @forAll statement

    @@ -2532,11 +2587,11 @@

    -
  • +
  • - § + §

    Read more quantifiers

    @@ -2548,11 +2603,11 @@

    -
  • +
  • - § + §

    End of the quantifier list

    @@ -2563,11 +2618,11 @@

    -
  • +
  • - § + §

    With explicit quantifiers, close the quantifier list

    @@ -2581,11 +2636,11 @@

    -
  • +
  • - § + §

    Read a dot

    @@ -2599,11 +2654,11 @@

    -
  • +
  • - § + §

    _getPathReader reads a potential path and then resumes with the given function

    @@ -2617,11 +2672,11 @@

    +
  • - § + §

    _readPath reads a potential path

    @@ -2633,11 +2688,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    Forward path

    @@ -2648,11 +2703,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    Backward path

    @@ -2663,11 +2718,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    Not a path; resume reading where we left off

    @@ -2679,11 +2734,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    If we were reading a list item, we still need to output it

    @@ -2694,11 +2749,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    The list item is the remaining subejct after reading the path

    @@ -2709,11 +2764,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    Switch back to the context of the list

    @@ -2724,11 +2779,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    Output the list item

    @@ -2743,11 +2798,11 @@

    _readPath reads a potenti

  • -
  • +
  • - § + §

    _readForwardPath reads a ‘!’ path

    @@ -2760,11 +2815,11 @@

    _readForwardPath reads a

  • -
  • +
  • - § + §

    The next token is the predicate

    @@ -2776,11 +2831,11 @@

    _readForwardPath reads a

  • -
  • +
  • - § + §

    If we were reading a subject, replace the subject by the path’s object

    @@ -2792,11 +2847,11 @@

    _readForwardPath reads a

  • -
  • +
  • - § + §

    If we were reading an object, replace the subject by the path’s object

    @@ -2808,11 +2863,11 @@

    _readForwardPath reads a

  • -
  • +
  • - § + §

    Emit the path’s current quad and read its next section

    @@ -2825,11 +2880,11 @@

    _readForwardPath reads a

  • -
  • +
  • - § + §

    _readBackwardPath reads a ‘^’ path

    @@ -2842,11 +2897,11 @@

    _readBackwardPath reads a

  • -
  • +
  • - § + §

    The next token is the predicate

    @@ -2858,11 +2913,11 @@

    _readBackwardPath reads a

  • -
  • +
  • - § + §

    If we were reading a subject, replace the subject by the path’s subject

    @@ -2874,11 +2929,11 @@

    _readBackwardPath reads a

  • -
  • +
  • - § + §

    If we were reading an object, replace the subject by the path’s subject

    @@ -2890,11 +2945,11 @@

    _readBackwardPath reads a

  • -
  • +
  • - § + §

    Emit the path’s current quad and read its next section

    @@ -2907,11 +2962,11 @@

    _readBackwardPath reads a

  • -
  • +
  • - § + §

    _readRDFStarTailOrGraph reads the graph of a nested RDF* quad or the end of a nested RDF* triple

    @@ -2923,11 +2978,11 @@

    +
  • - § + §

    An entity means this is a quad (only allowed if not already inside a graph)

    @@ -2943,11 +2998,11 @@

    +
  • - § + §

    _readRDFStarTail reads the end of a nested RDF* triple

    @@ -2960,11 +3015,11 @@

    _readRDFSta

  • -
  • +
  • - § + §

    Read the quad and restore the previous context

    @@ -2977,11 +3032,11 @@

    _readRDFSta

  • -
  • +
  • - § + §

    If the triple was the subject, continue by reading the predicate.

    @@ -2995,11 +3050,11 @@

    _readRDFSta

  • -
  • +
  • - § + §

    If the triple was the object, read context end.

    @@ -3014,11 +3069,11 @@

    _readRDFSta

  • -
  • +
  • - § + §

    _getContextEndReader gets the next reader function at the end of a context

    @@ -3044,11 +3099,11 @@

    +
  • - § + §

    _emit sends a quad through the callback

    @@ -3061,11 +3116,11 @@

    _emit sends a quad

  • -
  • +
  • - § + §

    _error emits an error message through the callback

    @@ -3085,11 +3140,11 @@

    _error

  • -
  • +
  • - § + §

    _resolveIRI resolves an IRI against the base path

    @@ -3102,11 +3157,11 @@

    _resolveIRI -
  • +
  • - § + §

    _resolveRelativeIRI resolves an IRI against the base path,

    assuming that a base path has been set and that the IRI is indeed relative

    @@ -3118,11 +3173,11 @@

    _resolv

  • -
  • +
  • - § + §

    An empty relative IRI indicates the base IRI

    @@ -3134,11 +3189,11 @@

    _resolv

  • -
  • +
  • - § + §

    Decide resolving strategy based in the first character

    @@ -3149,11 +3204,11 @@

    _resolv

  • -
  • +
  • - § + §

    Resolve relative fragment IRIs against the base IRI

    @@ -3164,11 +3219,11 @@

    _resolv

  • -
  • +
  • - § + §

    Resolve relative query string IRIs by replacing the query string

    @@ -3179,11 +3234,11 @@

    _resolv

  • -
  • +
  • - § + §

    Resolve root-relative IRIs at the root of the base IRI

    @@ -3194,11 +3249,11 @@

    _resolv

  • -
  • +
  • - § + §

    Resolve scheme-relative IRIs to the scheme

    @@ -3209,11 +3264,11 @@

    _resolv

  • -
  • +
  • - § + §

    Resolve all other IRIs at the base IRI’s path

    @@ -3224,11 +3279,11 @@

    _resolv

  • -
  • +
  • - § + §

    Relative IRIs cannot contain a colon in the first path segment

    @@ -3241,11 +3296,11 @@

    _resolv

  • -
  • +
  • - § + §

    _removeDotSegments resolves ‘./‘ and ‘../‘ path segments in an IRI as per RFC3986

    @@ -3256,11 +3311,11 @@

    +
  • - § + §

    Don’t modify the IRI if it does not contain any dot segments

    @@ -3272,11 +3327,11 @@

    +
  • - § + §

    Start with an imaginary slash before the IRI in order to resolve trailing ‘./‘ and ‘../‘

    @@ -3291,11 +3346,11 @@

    +
  • - § + §

    The path starts with the first slash after the authority

    @@ -3307,11 +3362,11 @@

    +
  • - § + §

    Skip two slashes before the authority

    @@ -3322,11 +3377,11 @@

    +
  • - § + §

    Skip to slash after the authority

    @@ -3340,11 +3395,11 @@

    +
  • - § + §

    Don’t modify a query string or fragment

    @@ -3358,11 +3413,11 @@

    +
  • - § + §

    Handle ‘/.’ or ‘/..’ path segments

    @@ -3376,11 +3431,11 @@

    +
  • - § + §

    Remove a ‘/.’ segment

    @@ -3394,11 +3449,11 @@

    +
  • - § + §

    Remove a trailing ‘/.’ segment

    @@ -3412,11 +3467,11 @@

    +
  • - § + §

    Remove a ‘/..’ segment

    @@ -3430,11 +3485,11 @@

    +
  • - § + §

    Try to remove the parent path from result

    @@ -3446,11 +3501,11 @@

    +
  • - § + §

    Remove a trailing ‘/..’ segment

    @@ -3471,11 +3526,11 @@

    +
  • - § + §

    Public methods

    @@ -3484,11 +3539,11 @@

    Public methods

  • -
  • +
  • - § + §

    parse parses the N3 input and emits each parsed quad through the callback

    @@ -3499,11 +3554,11 @@

    +
  • - § + §

    The read callback is the next function to be executed when a token arrives. We start reading in the top context.

    @@ -3522,11 +3577,11 @@

    +
  • - § + §

    Parse synchronously if no quad callback is given

    @@ -3546,11 +3601,11 @@

    +
  • - § + §

    Parse asynchronously otherwise, executing the read callback when a token arrives

    @@ -3569,11 +3624,11 @@

    +
  • - § + §

    The empty function

    @@ -3584,11 +3639,11 @@

    +
  • - § + §

    Initializes the parser with the given data factory

    @@ -3599,11 +3654,11 @@

    +
  • - § + §

    Set factory methods

    @@ -3620,11 +3675,11 @@

    +
  • - § + §

    Set common named nodes