| 1 | module CommentEnded; |
| 2 | import Out; |
| 3 | (* a comment that quotes the two characters that end one ends there *) |
| 4 | |
| 5 | (* Whether s matches the pattern. |
| 6 | Matches (?>x*) as one atom, which never gives back what it took, |
| 7 | so that a pattern stays linear. *) |
| 8 | proc matches(s: []U8): BOOL; |
| 9 | var i: INT; |
| 10 | begin |
| 11 | i := 0; |
| 12 | while i < LEN(s) do |
| 13 | INC(i); |
| 14 | end; |
| 15 | return i > 0; |
| 16 | end; |
| 17 | |
| 18 | proc main*; |
| 19 | begin |
| 20 | if matches("a") then Out.ln; end; |
| 21 | end; |
| 22 | end CommentEnded. |