|
Class: StringPattern
Object
|
+--StringPattern
|
+--StringPattern::Includes
|
+--StringPattern::Matches
|
+--StringPattern::StartsWith
- Package:
- stx:libbasic2
- Category:
- Collections-Text-Support
- Version:
- rev:
1.14
date: 2017/01/24 00:05:39
- user: cg
- file: StringPattern.st directory: libbasic2
- module: stx stc-classLibrary: libbasic2
- Author:
- Jan Vrany <jan.vrany@fit.cvut.cz>
A StringPattern instances are used to match string. The
pattern is build from a user-supplied string. It is the
intention to let the user type the search pattern - it can
be used for various live searches in lists, dialogs etc.
This is an unfinished class. More detailed description about
syntax and algorithm will be added once the results will be
considered good and the API become stable.
If not, blame it on JV :-)
[instance variables:]
[class variables:]
instance creation
-
includes: aString
-
-
matches: aString
-
-
readFrom: aStringOrStream onError: exceptionBlock
-
StringPattern readFrom: 'abcd'
StringPattern readFrom: ' abcd'
StringPattern readFrom: ' a??d'
StringPattern readFrom: ' a*d*'
StringPattern readFrom: 'abcd*'
-
startsWith: aString
-
conversion
-
asString
-
Returns a string representation of the pattern.
`StringPattern fromString: pattern asString` should return
the same pattern (same meaning equal)
** This method raises an error - it must be redefined in concrete classes **
initialization
-
on: anObject
-
matching
-
match: string
-
-
match: string case: case
-
-
match: string case: case relax: relax
-
-
match: string from: from to: to
-
-
match: string from: from to: to case: case
-
-
match: string from: from to: to case: case relax: relax
-
Answers true if receiver matches the given `string`
portion starting at `from`, ending at `to`.
If `case` is true, then perform natch case sensitive,
otherwise match case insensitive.
`relax` argument say how much the matching should
be relaxed - relax is a number in <1..3>, where
1 means no relaxing at all (aka exact match).
All patterns should support relax == 1. If the relax
level is not supported by a pattern, false must be
returned.
** This method raises an error - it must be redefined in concrete classes **
-
match: string from: from to: to relax: relax
-
-
match: string relax: relax
-
printing & storing
-
printOn: aStream
-
append a printed representation of the receiver to the argument, aStream
utilities
-
matchObject: anObject
-
Return true if pattern matches given object with relax level 1.
Some heuristics is performed to obtain the object's textual representation.
-
matchObject: object relax: relax
-
Return true if pattern matches given object.
Some heuristics is performed to obtain the object's textual representation.
Includes
Matches
Parser
StartsWith
|