Fixing xmode use lines; adding fake reluctant ?*+ to make XMode work (they're actually greedy)

db4
Daniel Ehrenberg 2009-03-08 18:50:41 -05:00
parent f7031eaad8
commit 762485c2ca
3 changed files with 7 additions and 3 deletions

View File

@ -158,6 +158,9 @@ Times = "," Number:n "}" => [[ 0 n <from-to> ]]
| Number:n "," Number:m "}" => [[ n m <from-to> ]] | Number:n "," Number:m "}" => [[ n m <from-to> ]]
Repeated = Element:e "{" Times:t => [[ e t <times> ]] Repeated = Element:e "{" Times:t => [[ e t <times> ]]
| Element:e "??" => [[ e <maybe> ]]
| Element:e "*?" => [[ e <star> ]]
| Element:e "+?" => [[ e <plus> ]]
| Element:e "?" => [[ e <maybe> ]] | Element:e "?" => [[ e <maybe> ]]
| Element:e "*" => [[ e <star> ]] | Element:e "*" => [[ e <star> ]]
| Element:e "+" => [[ e <plus> ]] | Element:e "+" => [[ e <plus> ]]

View File

@ -4,9 +4,8 @@ IN: xmode.marker
USING: kernel namespaces make xmode.rules xmode.tokens USING: kernel namespaces make xmode.rules xmode.tokens
xmode.marker.state xmode.marker.context xmode.utilities xmode.marker.state xmode.marker.context xmode.utilities
xmode.catalog sequences math assocs combinators strings xmode.catalog sequences math assocs combinators strings
regexp splitting ascii regexp.backend unicode.case regexp splitting ascii unicode.case regexp.matchers
ascii combinators.short-circuit accessors ; ascii combinators.short-circuit accessors ;
! regexp.backend is for the regexp class
! Next two words copied from parser-combinators ! Next two words copied from parser-combinators
! Just like head?, but they optionally ignore case ! Just like head?, but they optionally ignore case

View File

@ -1,6 +1,8 @@
! Copyright (C) 2008 Slava Pestov.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors xmode.tokens xmode.keyword-map kernel USING: accessors xmode.tokens xmode.keyword-map kernel
sequences vectors assocs strings memoize unicode.case sequences vectors assocs strings memoize unicode.case
regexp regexp.backend ; ! regexp.backend has the regexp class regexp ;
IN: xmode.rules IN: xmode.rules
TUPLE: string-matcher string ignore-case? ; TUPLE: string-matcher string ignore-case? ;