%YAML 1.2
---
# See http://www.sublimetext.com/docs/3/syntax.html
name: Uxn Assembly
scopeName: usm.
fileTypes: [usm]
file_extensions:
  - usm
scope: source.usm

contexts:
  main:
    # pointer
    - match: '\@(\S+)\s?'
      scope: string.control
      pop: true
    # jump
    - match: '\|(\S+)\s?'
      scope: variable.control
      pop: true
    # variables
    - match: '\;(\S+)\s?'
      scope: string.control
      pop: true
    # constants
    - match: '\:(\S+)\s?'
      scope: string.control
      pop: true
    # structs
    - match: '\&(\S+)\s?'
      scope: string.control
      pop: true

    # Special

    - match: '\~(\S+)\s?'
      scope: entity.name.type
      pop: true
    - match: '\=(\S+)\s?'
      scope: entity.name.type
      pop: true

    # Pushing to stack

    - match: '\,(\S+)\s?'
      scope: keyword.control
      pop: true
    - match: '\#(\S+)\s?'
      scope: keyword.control
      pop: true
    - match: '\.(\S+)\s?'
      scope: keyword.control
    - match: '\+(\S+)\s?'
      scope: string.control
      pop: true
    - match: '\-(\S+)\s?'
      scope: string.control

      # Blocks

    - match: '\{'
      scope: variable.control
      push:
        - meta_scope: variable.control
        - match: '\}'
          pop: true

    - match: '\('
      scope: comment
      push:
        - meta_scope: comment.line
        - match: '\)'
          pop: true

    - match: '\['
      scope: keyword
      push:
        - meta_scope: keyword.line
        - match: '\]'
          pop: true