Move `yaragg-parser-tools` collection to `yaragg/parser-tools`

remotes/jackfirth/master
Jack Firth 3 years ago
parent aa5a5ab533
commit 6c0930207f

@ -4,8 +4,8 @@
yaragg/codegen/codegen yaragg/codegen/codegen
yaragg/codegen/runtime yaragg/codegen/runtime
yaragg/codegen/flatten) yaragg/codegen/flatten)
yaragg-parser-tools/lex yaragg/parser-tools/lex
yaragg-parser-tools/cfg-parser yaragg/parser-tools/cfg-parser
(prefix-in bs: yaragg/support) (prefix-in bs: yaragg/support)
racket/set) racket/set)

@ -2,7 +2,7 @@
(require racket/match (require racket/match
racket/list racket/list
racket/generator racket/generator
(prefix-in lex: yaragg-parser-tools/lex) (prefix-in lex: yaragg/parser-tools/lex)
yaragg/support yaragg/support
yaragg/private/internal-support) yaragg/private/internal-support)

@ -4,7 +4,7 @@
;; A simple lexer for simple-line-drawing. ;; A simple lexer for simple-line-drawing.
(require yaragg/support (require yaragg/support
yaragg-parser-tools/lex) yaragg/parser-tools/lex)
(define (tokenize ip) (define (tokenize ip)
(port-count-lines! ip) (port-count-lines! ip)

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base yaragg/rules/parser)) (require (for-syntax racket/base yaragg/rules/parser))
(require yaragg-parser-tools/lex (require yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
yaragg/rules/parser yaragg/rules/parser
yaragg/rules/rule-structs yaragg/rules/rule-structs
(only-in yaragg/support from/to) (only-in yaragg/support from/to)
@ -163,7 +163,7 @@
(values "" end-pos)])) (values "" end-pos)]))
;; position->pos: position -> pos ;; position->pos: position -> pos
;; Converts position structures from yaragg-parser-tools/lex to our own pos structures. ;; Converts position structures from yaragg/parser-tools/lex to our own pos structures.
(define (position->pos a-pos) (define (position->pos a-pos)
(pos (position-offset a-pos) (pos (position-offset a-pos)
(position-line a-pos) (position-line a-pos)

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/yacc (require yaragg/parser-tools/yacc
yaragg-parser-tools/lex yaragg/parser-tools/lex
racket/list racket/list
racket/match racket/match
yaragg/rules/rule-structs) yaragg/rules/rule-structs)
@ -265,7 +265,7 @@
;; position->pos: position -> pos ;; position->pos: position -> pos
;; Coerses position structures from yaragg-parser-tools/lex to our own pos structures. ;; Coerses position structures from yaragg/parser-tools/lex to our own pos structures.
(define (position->pos a-pos) (define (position->pos a-pos)
(pos (position-offset a-pos) (pos (position-offset a-pos)
(position-line a-pos) (position-line a-pos)

@ -2,7 +2,7 @@
(provide (all-defined-out)) (provide (all-defined-out))
;; We keep our own position structure because yaragg-parser-tools/lex's position ;; We keep our own position structure because yaragg/parser-tools/lex's position
;; structure is non-transparent, hence highly resistant to unit testing. ;; structure is non-transparent, hence highly resistant to unit testing.
(struct pos (offset line col) (struct pos (offset line col)
#:transparent) #:transparent)

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require yaragg/rules/rule-structs (require yaragg/rules/rule-structs
yaragg-parser-tools/lex yaragg/parser-tools/lex
racket/match racket/match
syntax/strip-context) syntax/strip-context)

@ -1,11 +1,11 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/lex (require yaragg/parser-tools/lex
racket/string racket/string
racket/struct racket/struct
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
(for-syntax racket/base)) (for-syntax racket/base))
(provide (all-from-out yaragg-parser-tools/lex) (provide (all-from-out yaragg/parser-tools/lex)
(all-from-out yaragg-parser-tools/lex-sre) (all-from-out yaragg/parser-tools/lex-sre)
[struct-out token-struct] [struct-out token-struct]
token token
[struct-out exn:fail:parsing]) [struct-out exn:fail:parsing])

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require yaragg/rules/lexer (require yaragg/rules/lexer
rackunit rackunit
yaragg-parser-tools/lex) yaragg/parser-tools/lex)
(define (l s) (define (l s)
(define t (lex/1 (open-input-string s))) (define t (lex/1 (open-input-string s)))

@ -5,8 +5,8 @@
(require yaragg/examples/simple-line-drawing (require yaragg/examples/simple-line-drawing
yaragg/support yaragg/support
racket/list racket/list
yaragg-parser-tools/lex yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
rackunit) rackunit)
(define-tokens tokens (INTEGER STRING |;| EOF)) (define-tokens tokens (INTEGER STRING |;| EOF))
@ -72,5 +72,5 @@ EOF
;; FIXME: add tests to make sure location is as we expect. ;; FIXME: add tests to make sure location is as we expect.
;; ;;
;; FIXME: handle the EOF issue better. Something in cfg-parser ;; FIXME: handle the EOF issue better. Something in cfg-parser
;; appears to deviate from yaragg-parser-tools/yacc with regards to the stop ;; appears to deviate from yaragg/parser-tools/yacc with regards to the stop
;; token. ;; token.

@ -2,7 +2,7 @@
(require rackunit (require rackunit
yaragg-parser-tools/lex yaragg/parser-tools/lex
yaragg/rules/parser yaragg/rules/parser
yaragg/rules/lexer yaragg/rules/lexer
yaragg/rules/rule-structs) yaragg/rules/rule-structs)

@ -2,7 +2,7 @@
(require yaragg/examples/simple-arithmetic-grammar (require yaragg/examples/simple-arithmetic-grammar
yaragg/support yaragg/support
racket/set racket/set
yaragg-parser-tools/lex yaragg/parser-tools/lex
racket/list racket/list
rackunit) rackunit)

@ -3,8 +3,8 @@
(require yaragg/examples/simple-line-drawing (require yaragg/examples/simple-line-drawing
yaragg/support yaragg/support
racket/list racket/list
yaragg-parser-tools/lex yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
rackunit) rackunit)
(define (make-tokenizer ip) (define (make-tokenizer ip)
@ -68,5 +68,5 @@ EOF
;; FIXME: add tests to make sure location is as we expect. ;; FIXME: add tests to make sure location is as we expect.
;; ;;
;; FIXME: handle the EOF issue better. Something in cfg-parser ;; FIXME: handle the EOF issue better. Something in cfg-parser
;; appears to deviate from yaragg-parser-tools/yacc with regards to the stop ;; appears to deviate from yaragg/parser-tools/yacc with regards to the stop
;; token. ;; token.

@ -1,3 +0,0 @@
#lang info
(define scribblings '(("yaragg-parser-tools.scrbl" (multi-page) (parsing-library))))

@ -0,0 +1,3 @@
#lang info
(define scribblings '(("yaragg/parser-tools.scrbl" (multi-page) (parsing-library))))

@ -2,10 +2,10 @@
@(require scribble/manual scribble/struct scribble/xref scribble/bnf @(require scribble/manual scribble/struct scribble/xref scribble/bnf
(for-label scheme/base (for-label scheme/base
scheme/contract scheme/contract
yaragg-parser-tools/lex yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
yaragg-parser-tools/yacc yaragg/parser-tools/yacc
yaragg-parser-tools/cfg-parser)) yaragg/parser-tools/cfg-parser))
@title{Parser Tools: @exec{lex} and @exec{yacc}-style Parsing (BR edition)} @title{Parser Tools: @exec{lex} and @exec{yacc}-style Parsing (BR edition)}
@ -26,7 +26,7 @@ This documentation assumes familiarity with @exec{lex}- and @exec{yacc}-style le
@section-index["scanning"] @section-index["scanning"]
@section-index["scanner"] @section-index["scanner"]
@defmodule[yaragg-parser-tools/lex] @defmodule[yaragg/parser-tools/lex]
@; ---------------------------------------- @; ----------------------------------------
@ -69,7 +69,7 @@ This documentation assumes familiarity with @exec{lex}- and @exec{yacc}-style le
@itemize[ @itemize[
@item{@racket[id] --- expands to the named @deftech{lexer abbreviation}; @item{@racket[id] --- expands to the named @deftech{lexer abbreviation};
abbreviations are defined via @racket[define-lex-abbrev] or supplied by modules abbreviations are defined via @racket[define-lex-abbrev] or supplied by modules
like @racketmodname[yaragg-parser-tools/lex-sre].} like @racketmodname[yaragg/parser-tools/lex-sre].}
@item{@racket[string] --- matches the sequence of characters in @racket[string].} @item{@racket[string] --- matches the sequence of characters in @racket[string].}
@item{@racket[character] --- matches a literal @racket[character].} @item{@racket[character] --- matches a literal @racket[character].}
@item{@racket[(repetition lo hi re)] --- matches @racket[re] repeated between @racket[lo] @item{@racket[(repetition lo hi re)] --- matches @racket[re] repeated between @racket[lo]
@ -94,15 +94,15 @@ empty string, @racket[(union)] matches nothing,
The regular expression language is not designed to be used directly, The regular expression language is not designed to be used directly,
but rather as a basis for a user-friendly notation written with but rather as a basis for a user-friendly notation written with
regular expression macros. For example, regular expression macros. For example,
@racketmodname[yaragg-parser-tools/lex-sre] supplies operators from Olin @racketmodname[yaragg/parser-tools/lex-sre] supplies operators from Olin
Shivers's SREs, and @racketmodname[yaragg-parser-tools/lex-plt-v200] supplies Shivers's SREs, and @racketmodname[yaragg/parser-tools/lex-plt-v200] supplies
(deprecated) operators from the previous version of this library. (deprecated) operators from the previous version of this library.
Since those libraries provide operators whose names match other Racket Since those libraries provide operators whose names match other Racket
bindings, such as @racket[*] and @racket[+], they normally must be bindings, such as @racket[*] and @racket[+], they normally must be
imported using a prefix: imported using a prefix:
@racketblock[ @racketblock[
(require (prefix-in : yaragg-parser-tools/lex-sre)) (require (prefix-in : yaragg/parser-tools/lex-sre))
] ]
The suggested prefix is @racket[:], so that @racket[:*] and The suggested prefix is @racket[:], so that @racket[:*] and
@ -360,14 +360,14 @@ characters, @racket[char-lower-case?] characters, etc.}
@subsection{Lexer SRE Operators} @subsection{Lexer SRE Operators}
@defmodule[yaragg-parser-tools/lex-sre] @defmodule[yaragg/parser-tools/lex-sre]
@; Put the docs in a macro, so that we can bound the scope of @; Put the docs in a macro, so that we can bound the scope of
@; the import of `*', etc.: @; the import of `*', etc.:
@(define-syntax-rule (lex-sre-doc) @(define-syntax-rule (lex-sre-doc)
(... (...
(begin (begin
(require (for-label yaragg-parser-tools/lex-sre)) (require (for-label yaragg/parser-tools/lex-sre))
@defform[(* re ...)]{ @defform[(* re ...)]{
@ -437,16 +437,16 @@ characters.}
@subsection{Lexer Legacy Operators} @subsection{Lexer Legacy Operators}
@defmodule[yaragg-parser-tools/lex-plt-v200] @defmodule[yaragg/parser-tools/lex-plt-v200]
@(define-syntax-rule (lex-v200-doc) @(define-syntax-rule (lex-v200-doc)
(... (...
(begin (begin
(require (for-label yaragg-parser-tools/lex-plt-v200)) (require (for-label yaragg/parser-tools/lex-plt-v200))
@t{The @racketmodname[yaragg-parser-tools/lex-plt-v200] module re-exports @t{The @racketmodname[yaragg/parser-tools/lex-plt-v200] module re-exports
@racket[*], @racket[+], @racket[?], and @racket[&] from @racket[*], @racket[+], @racket[?], and @racket[&] from
@racketmodname[yaragg-parser-tools/lex-sre]. It also re-exports @racketmodname[yaragg/parser-tools/lex-sre]. It also re-exports
@racket[:or] as @racket[:], @racket[::] as @racket[|@|], @racket[:~] @racket[:or] as @racket[:], @racket[::] as @racket[|@|], @racket[:~]
as @racket[^], and @racket[:/] as @racket[-].} as @racket[^], and @racket[:/] as @racket[-].}
@ -467,7 +467,7 @@ The same as @racket[(complement re ...)].})))
Each @racket[_action-expr] in a @racket[lexer] form can produce any Each @racket[_action-expr] in a @racket[lexer] form can produce any
kind of value, but for many purposes, producing a @deftech{token} kind of value, but for many purposes, producing a @deftech{token}
value is useful. Tokens are usually necessary for inter-operating with value is useful. Tokens are usually necessary for inter-operating with
a parser generated by @racket[yaragg-parser-tools/parser], but tokens may not a parser generated by @racket[yaragg/parser-tools/parser], but tokens may not
be the right choice when using @racket[lexer] in other situations. be the right choice when using @racket[lexer] in other situations.
@defform[(define-tokens group-id (token-id ...))]{ @defform[(define-tokens group-id (token-id ...))]{
@ -513,7 +513,7 @@ be the right choice when using @racket[lexer] in other situations.
@section-index["yacc"] @section-index["yacc"]
@defmodule[yaragg-parser-tools/yacc] @defmodule[yaragg/parser-tools/yacc]
@defform/subs[#:literals (grammar tokens start end precs src-pos @defform/subs[#:literals (grammar tokens start end precs src-pos
suppress debug yacc-output prec) suppress debug yacc-output prec)
@ -712,9 +712,9 @@ be the right choice when using @racket[lexer] in other situations.
@section-index["cfg-parser"] @section-index["cfg-parser"]
@defmodule[yaragg-parser-tools/cfg-parser]{The @racketmodname[yaragg-parser-tools/cfg-parser] @defmodule[yaragg/parser-tools/cfg-parser]{The @racketmodname[yaragg/parser-tools/cfg-parser]
library provides a parser generator that is an alternative to that of library provides a parser generator that is an alternative to that of
@racketmodname[yaragg-parser-tools/yacc].} @racketmodname[yaragg/parser-tools/yacc].}
@defform/subs[#:literals (grammar tokens start end precs src-pos @defform/subs[#:literals (grammar tokens start end precs src-pos
suppress debug yacc-output prec) suppress debug yacc-output prec)
@ -731,7 +731,7 @@ library provides a parser generator that is an alternative to that of
Creates a parser similar to that of @racket[parser]. Unlike @racket[parser], Creates a parser similar to that of @racket[parser]. Unlike @racket[parser],
@racket[cfg-parser], can consume arbitrary and potentially ambiguous context-free @racket[cfg-parser], can consume arbitrary and potentially ambiguous context-free
grammars. Its interface is a subset of @racketmodname[yaragg-parser-tools/yacc], with grammars. Its interface is a subset of @racketmodname[yaragg/parser-tools/yacc], with
the following differences: the following differences:
@itemize[ @itemize[
@ -751,7 +751,7 @@ library provides a parser generator that is an alternative to that of
@section{Converting @exec{yacc} or @exec{bison} Grammars} @section{Converting @exec{yacc} or @exec{bison} Grammars}
@defmodule[yaragg-parser-tools/yacc-to-scheme] @defmodule[yaragg/parser-tools/yacc-to-scheme]
@defproc[(trans [file path-string?]) any/c]{ @defproc[(trans [file path-string?]) any/c]{

@ -31,12 +31,12 @@
(require yaragg-parser-tools/yacc (require yaragg/parser-tools/yacc
yaragg-parser-tools/lex) yaragg/parser-tools/lex)
(require (for-syntax racket/base (require (for-syntax racket/base
syntax/boundmap syntax/boundmap
yaragg-parser-tools/private-lex/token-syntax)) yaragg/parser-tools/private-lex/token-syntax))
(provide cfg-parser) (provide cfg-parser)
@ -752,7 +752,7 @@
(module* test racket/base (module* test racket/base
(require (submod "..") (require (submod "..")
yaragg-parser-tools/lex yaragg/parser-tools/lex
racket/block racket/block
rackunit) rackunit)

@ -4,9 +4,9 @@
;; Import the parser and lexer generators. ;; Import the parser and lexer generators.
(require yaragg-parser-tools/yacc (require yaragg/parser-tools/yacc
yaragg-parser-tools/lex yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)) (prefix-in : yaragg/parser-tools/lex-sre))
(define-tokens value-tokens (NUM VAR FNCT)) (define-tokens value-tokens (NUM VAR FNCT))
(define-empty-tokens op-tokens (newline = OP CP + - * / ^ EOF NEG)) (define-empty-tokens op-tokens (newline = OP CP + - * / ^ EOF NEG))

@ -4,9 +4,9 @@
;; list of syntax objects, instead of returning one syntax object at a time ;; list of syntax objects, instead of returning one syntax object at a time
(require (for-syntax racket/base) (require (for-syntax racket/base)
yaragg-parser-tools/lex yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
yaragg-parser-tools/yacc yaragg/parser-tools/yacc
syntax/readerr) syntax/readerr)
(define-tokens data (DATUM)) (define-tokens data (DATUM))

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base) (require (for-syntax racket/base)
yaragg-parser-tools/lex yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre)) (prefix-in : yaragg/parser-tools/lex-sre))
(provide epsilon ~ (provide epsilon ~
(rename-out [:* *] (rename-out [:* *]

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base) (require (for-syntax racket/base)
yaragg-parser-tools/lex) yaragg/parser-tools/lex)
(provide (rename-out [sre-* *] (provide (rename-out [sre-* *]
[sre-+ +] [sre-+ +]

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base) (require (for-syntax racket/base)
yaragg-parser-tools/lex yaragg/parser-tools/lex
rackunit) rackunit)
(define-syntax (catch-syn-error stx) (define-syntax (catch-syn-error stx)

@ -1,5 +1,5 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-lex/util syntax/id-table racket/syntax) (require yaragg/parser-tools/private-lex/util syntax/id-table racket/syntax)
(provide parse) (provide parse)
(define (bad-args stx num) (define (bad-args stx num)

@ -1,5 +1,5 @@
#lang racket/base #lang racket/base
(require (for-syntax racket/base yaragg-parser-tools/private-lex/token-syntax)) (require (for-syntax racket/base yaragg/parser-tools/private-lex/token-syntax))
;; Defining tokens ;; Defining tokens

@ -1,5 +1,5 @@
#lang racket/base #lang racket/base
(require racket/promise yaragg-parser-tools/private-lex/util) (require racket/promise yaragg/parser-tools/private-lex/util)
(provide (all-defined-out)) (provide (all-defined-out))

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-yacc/yacc-helper (require yaragg/parser-tools/private-yacc/yacc-helper
yaragg-parser-tools/private-lex/token-syntax yaragg/parser-tools/private-lex/token-syntax
yaragg-parser-tools/private-yacc/grammar yaragg/parser-tools/private-yacc/grammar
racket/class racket/class
racket/contract racket/contract
(for-template racket/base)) (for-template racket/base))

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-yacc/lr0 (require yaragg/parser-tools/private-yacc/lr0
yaragg-parser-tools/private-yacc/grammar yaragg/parser-tools/private-yacc/grammar
racket/list racket/list
racket/class) racket/class)

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-yacc/grammar (require yaragg/parser-tools/private-yacc/grammar
yaragg-parser-tools/private-yacc/graph yaragg/parser-tools/private-yacc/graph
racket/list racket/list
racket/class) racket/class)

@ -1,5 +1,5 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-yacc/grammar) (require yaragg/parser-tools/private-yacc/grammar)
(provide (except-out (all-defined-out) make-reduce make-reduce*) (provide (except-out (all-defined-out) make-reduce make-reduce*)
(rename-out [make-reduce* make-reduce])) (rename-out [make-reduce* make-reduce]))

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-yacc/input-file-parser (require yaragg/parser-tools/private-yacc/input-file-parser
yaragg-parser-tools/private-yacc/grammar yaragg/parser-tools/private-yacc/grammar
yaragg-parser-tools/private-yacc/table yaragg/parser-tools/private-yacc/table
racket/class racket/class
racket/contract) racket/contract)
(require (for-template racket/base)) (require (for-template racket/base))

@ -1,8 +1,8 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/private-yacc/grammar (require yaragg/parser-tools/private-yacc/grammar
yaragg-parser-tools/private-yacc/lr0 yaragg/parser-tools/private-yacc/lr0
yaragg-parser-tools/private-yacc/lalr yaragg/parser-tools/private-yacc/lalr
yaragg-parser-tools/private-yacc/parser-actions yaragg/parser-tools/private-yacc/parser-actions
racket/contract racket/contract
racket/list racket/list
racket/class) racket/class)

@ -1,6 +1,6 @@
#lang racket/base #lang racket/base
(require (prefix-in rl: racket/list) (require (prefix-in rl: racket/list)
yaragg-parser-tools/private-lex/token-syntax) yaragg/parser-tools/private-lex/token-syntax)
;; General helper routines ;; General helper routines
(provide duplicate-list? remove-duplicates overlap? vector-andmap display-yacc) (provide duplicate-list? remove-duplicates overlap? vector-andmap display-yacc)

@ -1,7 +1,7 @@
#lang racket/base #lang racket/base
(require yaragg-parser-tools/lex (require yaragg/parser-tools/lex
(prefix-in : yaragg-parser-tools/lex-sre) (prefix-in : yaragg/parser-tools/lex-sre)
yaragg-parser-tools/yacc yaragg/parser-tools/yacc
syntax/readerr syntax/readerr
racket/list) racket/list)
(provide trans) (provide trans)

@ -5,7 +5,7 @@
(for-label racket (for-label racket
yaragg yaragg
yaragg/support yaragg/support
(only-in yaragg-parser-tools/lex lexer-src-pos) (only-in yaragg/parser-tools/lex lexer-src-pos)
(only-in syntax/parse syntax-parse ~literal))) (only-in syntax/parse syntax-parse ~literal)))
@ -264,11 +264,11 @@ A @emph{token} is the smallest meaningful element of a source program. Tokens ca
If possible, we also want to attach source location information to each token. Why? Because this information will be incorporated into the syntax objects produced by @racket[parse]. If possible, we also want to attach source location information to each token. Why? Because this information will be incorporated into the syntax objects produced by @racket[parse].
A parser often works in conjunction with a helper function called a @emph{lexer} that converts the raw code of the source program into tokens. The @racketmodname[yaragg-parser-tools/lex] library can help us write a position-sensitive A parser often works in conjunction with a helper function called a @emph{lexer} that converts the raw code of the source program into tokens. The @racketmodname[yaragg/parser-tools/lex] library can help us write a position-sensitive
tokenizer: tokenizer:
@interaction[#:eval my-eval @interaction[#:eval my-eval
(require yaragg-parser-tools/lex) (require yaragg/parser-tools/lex)
(define (tokenize ip) (define (tokenize ip)
(port-count-lines! ip) (port-count-lines! ip)
(define my-lexer (define my-lexer
@ -307,7 +307,7 @@ Note also from this lexer example:
@item{@racket[parse] accepts as input either a sequence of tokens, or a @item{@racket[parse] accepts as input either a sequence of tokens, or a
function that produces tokens (which @racket[parse] will call repeatedly to get the next token).} function that produces tokens (which @racket[parse] will call repeatedly to get the next token).}
@item{As an alternative to the basic @racket[token] structure, a token can also be an instance of the @racket[position-token] structure (also found in @racketmodname[yaragg-parser-tools/lex]). In that case, the token will try to derive its position from that of the position-token.} @item{As an alternative to the basic @racket[token] structure, a token can also be an instance of the @racket[position-token] structure (also found in @racketmodname[yaragg/parser-tools/lex]). In that case, the token will try to derive its position from that of the position-token.}
@item{@racket[parse] will stop if it gets @racket[void] (or @racket['eof]) as a token.} @item{@racket[parse] will stop if it gets @racket[void] (or @racket['eof]) as a token.}
@ -939,8 +939,8 @@ bindings. The most important of these is @racket[parse]:
@item{a string} @item{a string}
@item{a symbol} @item{a symbol}
@item{an instance produced by @racket[token]} @item{an instance produced by @racket[token]}
@item{an instance produced by the token constructors of @racketmodname[yaragg-parser-tools/lex]} @item{an instance produced by the token constructors of @racketmodname[yaragg/parser-tools/lex]}
@item{an instance of @racketmodname[yaragg-parser-tools/lex]'s @racket[position-token] whose @item{an instance of @racketmodname[yaragg/parser-tools/lex]'s @racket[position-token] whose
@racket[position-token-token] is a @tech{token}.} @racket[position-token-token] is a @tech{token}.}
] ]
@ -1045,7 +1045,7 @@ The @racketmodname[yaragg/support] module provides functions to interact with
@tt{brag} programs. The most useful is the @racket[token] function, which @tt{brag} programs. The most useful is the @racket[token] function, which
produces tokens to be parsed. produces tokens to be parsed.
In addition to the exports shown below, the @racketmodname[yaragg/support] module also provides everything from @racketmodname[yaragg/support], and everything from @racketmodname[yaragg-parser-tools/lex]. In addition to the exports shown below, the @racketmodname[yaragg/support] module also provides everything from @racketmodname[yaragg/support], and everything from @racketmodname[yaragg/parser-tools/lex].
@defproc[(token [type (or/c string? symbol?)] @defproc[(token [type (or/c string? symbol?)]

Loading…
Cancel
Save