Advertisement
Guest User

Untitled

a guest
Nov 17th, 2019
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PCRE 1.41 KB | None | 0 0
  1.     (?:
  2.         ^system()                  # \1 (this is a system)
  3.     |
  4.         \G(\R)?\t                  # \2 (this is our first of this type)
  5.         (?:
  6.             link()                 # \3 (this is a link)
  7.         |
  8.             \t*object()            # \4 (this is a object)
  9.         )
  10.     )
  11.      (?|"([^"]*)"|(.*))            # \5 (system/link/object name)
  12.     (?(1)\R\tpos (\S+) (\S+))      # \6 (x pos), \7 (y pos)
  13.     (?:
  14.         (?:\1|\3)
  15.         (?=
  16.             (?:
  17.                 \R?^\t
  18.                 (?:
  19.                     link ()        # \8 (we have at least one link)
  20.                 |
  21.                 ).*
  22.             )*
  23.         )
  24.     )?
  25.     (                              # \9 (this is a link or object)
  26.         \3(?:\R(?=\tlink )|())     # advance to next link in such a way that we'll know when we reach it that it's not the first one, or \10 (this is our last link)
  27.     |
  28.         \4(?:                      # advance to next object in such a way that we'll know when we reach it that it's not the first one
  29.             (?:\R\t.*)*?
  30.             \R(?=\t+object )
  31.         )?
  32.     )?
  33. |
  34.     ^\S.*                          # comment, or top-level thing that's not a system
  35.     (?:\R\t.*)*
  36. |
  37.     \G\R\t.*
  38. |
  39.     ^\R
  40.  
  41. (?9(?2:,))                         # comma between link/object names
  42. $5                                 # system/link/object name
  43. (?1
  44.     \t$6\t$7                       # system x pos, y pos
  45.     \t                             # tab before links
  46.     (?8:\t)                        # tab before objects, in case of no links
  47. )
  48. (?10\t)                            # tab before objects, after last link
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement