}}} * parse {{{ */
(sc *scanner, allowset bool)
| 308 | /* parse {{{ */ |
| 309 | |
| 310 | func parseClass(sc *scanner, allowset bool) class { |
| 311 | ch := sc.Next() |
| 312 | switch ch { |
| 313 | case '%': |
| 314 | return &singleClass{sc.Next()} |
| 315 | case '.': |
| 316 | if allowset { |
| 317 | return &dotClass{} |
| 318 | } |
| 319 | return &charClass{ch} |
| 320 | case '[': |
| 321 | if allowset { |
| 322 | return parseClassSet(sc) |
| 323 | } |
| 324 | return &charClass{ch} |
| 325 | //case '^' '$', '(', ')', ']', '*', '+', '-', '?': |
| 326 | // panic(newError(sc.CurrentPos(), "invalid %c", ch)) |
| 327 | case EOS: |
| 328 | panic(newError(sc.CurrentPos(), "unexpected EOS")) |
| 329 | default: |
| 330 | return &charClass{ch} |
| 331 | } |
| 332 | } |
| 333 | |
| 334 | func parseClassSet(sc *scanner) class { |
| 335 | set := &setClass{false, []class{}} |
no test coverage detected
searching dependent graphs…