IBM SC34-5764-01 User Manual

Page 237

Advertising
background image

┌────────────────────────────────────────────────┐

│

┌─────────────┐

┌────────────────────────────────┐

│

│Start:

│yes │String start=match end.

│

│

│End of

├─── │Match start=length + 1.

│

│

│template?

│

│Match end=length + 1. Return.

│

│

└─────┬───────┘

└────────────────────────────────┘

│

no

│

┌─────────────┐

┌────────────────────────────────┐

│

│Token period │yes │

│

│

│or variable? ├─── │Step to next token.

├───┘

└─────┬───────┘

└────────────────────────────────┘

no

┌─────────────┐

┌─────────┐

┌──────────┐

┌───────────────────────────────────┐

│Token a plus?│yes │Variable │yes │Resolve

│

│String start=match start.

│

│

├─── │form?

├─── │its value.├── │Match start=min(length + 1,

│

└─────┬───────┘

└────┬────┘

└──────────┘

│ match start + value).

│

│ no

│ no

│

│Match end=match start. Return.

│

└─────────────────────┘

└───────────────────────────────────┘

┌─────────────┐

┌─────────┐

┌──────────┐

┌───────────────────────────────────┐

│Token a

│yes │Variable │yes │Resolve

│

│String start=match start.

│

│minus?

├─── │form?

├─── │its value.├── │Match start=max(1, match

│

└─────┬───────┘

└────┬────┘

└──────────┘

│ start ─ value).

│

│ no

│ no

│

│Match end=match start. Return.

│

└─────────────────────┘

└───────────────────────────────────┘

┌─────────────┐

┌─────────┐

┌──────────┐

┌───────────────────────────────────┐

│Token an

│yes │Variable │yes │Resolve

│

│String start=match end.

│

│equal?

├─── │form?

├─── │its value.├── │Match start=min(length+1, value).

│

└─────┬───────┘

└────┬────┘

└──────────┘

│Match end=match start. Return.

│

│ no

│ no

│

└───────────────────────────────────┘

└─────────────────────┘

┌─────────────┐

┌───────────────────────────────────┐

│Token a

│yes │String start=match end.

│

│number?

├─── │Match start=min(length+1, value).

│

└─────┬───────┘

│Match end=match start. Return.

│

no

└───────────────────────────────────┘

┌─────────────┐
│Token a lit─ │yes
│eral string? ├──────────────────────────┐
└─────┬───────┘

│

│ no

│

┌─────────────┐

┌──────────┐

┌───────────────┐

┌─────────────────────────────┐

│Token a var─ │yes │Resolve

│

│Match found in │yes │String start=match end.

│

│iable string?├─── │its value.├── │rest of string?├─── │Match start=match position.

│

└─────┬───────┘

└──────────┘

└──────┬────────┘

│Match end=match position +

│

│ no

│ no

│ pattern length.

Return.

│

│

└─────────────────────────────┘

│

┌────────────────────────────────┐

│

│String start=match end.

│

│

│Match start=length + 1.

│

│

│Match end=length + 1. Return.

│

└────────────────────────────────┘

┌─────────────┐

┌────────────────────────────────┐

│Token a

│yes

│Match start=length + 1.

│

│ comma?

├───────── │Match end=length + 1. Return.

│

└─────────────┘

└────────────────────────────────┘

Figure 51. Conceptual View of Finding Next Pattern

Parsing

Chapter 15. Parsing

215

Advertising