Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- (?:
- ^system() # \1 (this is a system)
- |
- \G(\R)?\t # \2 (this is our first of this type)
- (?:
- link() # \3 (this is a link)
- |
- \t*object() # \4 (this is a object)
- )
- )
- (?|"([^"]*)"|(.*)) # \5 (system/link/object name)
- (?(1)\R\tpos (\S+) (\S+)) # \6 (x pos), \7 (y pos)
- (?:
- (?:\1|\3)
- (?=
- (?:
- \R?^\t
- (?:
- link () # \8 (we have at least one link)
- |
- ).*
- )*
- )
- )?
- ( # \9 (this is a link or object)
- \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)
- |
- \4(?: # advance to next object in such a way that we'll know when we reach it that it's not the first one
- (?:\R\t.*)*?
- \R(?=\t+object )
- )?
- )?
- |
- ^\S.* # comment, or top-level thing that's not a system
- (?:\R\t.*)*
- |
- \G\R\t.*
- |
- ^\R
- (?9(?2:,)) # comma between link/object names
- $5 # system/link/object name
- (?1
- \t$6\t$7 # system x pos, y pos
- \t # tab before links
- (?8:\t) # tab before objects, in case of no links
- )
- (?10\t) # tab before objects, after last link
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement