span

package module
v0.0.0-...-74209b5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 8, 2024 License: BSD-2-Clause Imports: 0 Imported by: 2

README

Text spanners for GOPL

  Point, group, and class sequence operators.


Point

  A character code point in the ASCII domain is typically
  synactically relative to a syntactic frame or scope.


Group

  A group span is exemplified by the XML code.  The XML
  specification assures the syntactic uniqueness of its
  principal character codes, requiring that syntactic
  violations are encoded alternatively.

	var xml []byte = []byte(...)
	var ofs, len = 0, len(xml)
	for ofs < len {
		var first, last = ofs, Forward(xml,ofs,len,'<','>')
		if first < last {
			var begin, end int = first, (last+1)
			var span []byte = xml[begin:end]
			fmt.Printf("\t[%03o,%03o]\t%s\n",first,last,string(span))
			ofs = end
		} else {
			ofs += 1
		}
	}

  Another group code example is SEXP.

  These are (both) demonstrated in "span_test".


Class

  A character class code is exemplified by the URI code.
  The density of syntactic freedom is relatively maximized
  with respect to the ASCII code.  Conversely, the
  distinction of class is ambiguated in size.  The larger
  the character class membership set, the less freedom
  remains available to any alternative class of distinct
  uniqueness.


References

  [XML] https://www.w3.org/TR/REC-xml/REC-xml-20081126.xml
  [SXP] https://datatracker.ietf.org/doc/draft-rivest-sexp/
  [URI] https://datatracker.ietf.org/doc/rfc3986/
  [ASC] https://datatracker.ietf.org/doc/html/rfc20

Documentation

Overview

* Text spanners for GOPL * Copyright 2024 John Douglas Pritchard, Syntelos

* Text spanners for GOPL * Copyright 2024 John Douglas Pritchard, Syntelos

* Text spanners for GOPL * Copyright 2024 John Douglas Pritchard, Syntelos

* Text spanners for GOPL * Copyright 2024 John Douglas Pritchard, Syntelos

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Cat

func Cat(a, b []byte) (c []byte)

* Byte string concatenation operator.

func Class

func Class(src []byte, ofs, len int, clop CC) (spx int)

* Character class spanner.

func First

func First(src []byte, ofs int, len int, ch byte) (spx int)

* Sequential point operator.

func Forward

func Forward(src []byte, ofs int, len int, lhs byte, rhs byte) int

* Sequential group iterator.

func GI

func GI(ch byte) bool

* Generic identifier character class.

func Group

func Group(src []byte, ofs int, len int, lhs byte) int

* Nested group operator.

func GroupRhs

func GroupRhs(lhs byte) byte

* Group code resolver.

func Last

func Last(src []byte, ofs int, len int, ch byte) (spx int)

* Sequential point operator.

func Reverse

func Reverse(src []byte, ofs int, len int, lhs byte, rhs byte) int

* Sequential group iterator.

func WS

func WS(ch byte) bool

* Whitespace character class.

func XA

func XA(ch byte) bool

* XML Attribute character class.

func XC

func XC(ch byte) bool

* XML Code character class.

func XI

func XI(ch byte) bool

* XML Identifier character class.

Types

type CC

type CC func(byte) bool

* Character class operator.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL