tpluscode
7/25/2019 - 7:38 AM

Hypertest code coloring

Hypertest code coloring

#################################################################
## Iro
################################################################ 
##
## * Press Ctrl + '+'/'-' To Zoom in
## * Press Ctrl + S to save and recalculate... 
## * Documents are saved to web storage.
## * Only one save slot supported.
## * Matches cannot span lines.
## * Unicode chars must be defined in \u0000 to \uffff format.
## * All matches must be contained by a single group ( ... )
## * Look behinds not permitted, (?<= or (?<!
## * Look forwards are permitted (?= or (?!
## * Constants are defined as __my_const = (......)
## * The \= format allows unescaped regular expressions
## * Constants referenced by match \= $${__my_const}
## * Constants can reference other constants
## * You are free to delete all the default scopes.
## * Twitter : ainslec , Web: http://eeyo.io/iro
##
################################################################

name                   = hypertest
file_extensions []     = api,hydra;

################################################################
## Constants
################################################################

__MODIFIERS \= (With|Expect|PREFIX)
__STEPS \= (Operation|Class|Property|Link|Status|Header|Invoke)
__URI \= (<.+>|\w+:\w+)

################################################################
## Styles
################################################################

styles [] {

.comment : style {
   color                 = light_green
   italic                = true
   ace_scope             = comment
   textmate_scope        = comment
   pygments_scope        = Comment
}

.modifier : style {
   color     = cyan
   ace_scope             = keyword
   textmate_scope        = keyword
   pygments_scope        = Keyword
}

.step : style {
   color     = #12ff45
   ace_scope             = step
   textmate_scope        = step
   pygments_scope        = Keyword.Reserved
}

.numeric : style {
   color                 = gold
   ace_scope             = constant.numeric
   textmate_scope        = constant.numeric
   pygments_scope        = Number
}

.punctuation : style {
   color     = red_2
   ace_scope             = punctuation
   textmate_scope        = punctuation
   pygments_scope        = Punctuation
}

.text : style {
   color                 = brown
   ace_scope             = text
   textmate_scope        = text
   pygments_scope        = String
}

.uri : style {
   color                 = gold
   ace_scope             = storage
   textmate_scope        = storage
   pygments_scope        = Generic.Strong
}

.illegal : style {
   color                 = white
   background_color      = red
   ace_scope             = invalid
   textmate_scope        = invalid
   pygments_scope        = Generic.Error
}

}

#################################################
## Parse contexts
#################################################

contexts [] {

##############################################
## Main Context - Entry point context
##############################################

main : context {

   : include "multi_line_comment" ;

   : pattern {
      regex          \= $${__MODIFIERS}
      styles []       = .modifier;
   }

   : pattern {
      regex          \= $${__STEPS}
      styles []       = .step;
   }

   : pattern {
      regex          \= (=>|>>>)
      styles []       = .punctuation;
   }

   : pattern {
      regex          \= $${__URI}
      styles []       = .uri;
   }
   
   : inline_push {
      regex          \= (\{)
      styles []       = .punctuation;
      : pop {  
         regex       \= (\})
         styles []    = .punctuation;
      }
      : include "main" ;
   }
   
   : inline_push {
      regex          \= $${__MODIFIERS} $${__STEPS}
      styles []       = .punctuation;
      : pop {  
         regex       \= (\})
         styles []    = .punctuation;
      }
      : include "main" ;
   }
   
   : inline_push {
      regex          \= (\")
      styles []       = .punctuation;
      default_style   = .text
      : pop {
         regex       \= (\")
         styles []    = .punctuation;
      }
   }
   
}

#################################################
## End of Contexts
#################################################

###########################################
## Numeric Context
###########################################

numeric : context {
   : pattern {
      regex          \= (\b\d+)
      styles []       = .numeric;
   }
}

###########################################
## Multi Line Comment Context
###########################################

multi_line_comment : context {
   description        = multiline
   : inline_push {
      regex          \= (/\*)
      styles []       = .comment;
      default_style   = .comment
      : pop {
         regex       \= (\*/)
         styles []    = .comment;
      }
   }
}
   
}
  1. Go to https://eeyo.io/iro/
  2. Paste highlighting.iro in the left text box
  3. Paste scenario.hydra in the top text box
  4. Hit ▶️ button
  5. Enjoy code highlighting
  6. Export for Ace, Texmate or others
PREFIX api: <https://rdf-cube-curation.described.at/api#>
PREFIX hydra: <http://www.w3.org/ns/hydra/core#>

With Class api:Entrypoint {
    Expect Property api:dataCubeProjects {
        Expect Operation api:CreateDataCubeProject
    }
}

With Operation api:CreateDataCubeProject {

    /*
        Operation should succeed for a csv
    */
    Invoke {
        Content-Type "text/csv"

        <<< "test/CreateDataCubeProject/sample-input.csv"
    } => {
        Expect Status 201
        Expect Header Location

        Expect Type api:DataCubeProject
        Expect Link api:DataCubeProject_csvwMetadata {
            Expect Header Content-Type "application/csvm+json"
        }

        Expect Property api:DataCubeProject_column {
            Expect Type hydra:Collection

            Expect Property hydra:member {
                Expect Type api:DataCubeColumn

                Expect Property api:DataCubeColumn_unmapped true
                Expect Property hydra:totalItems 19
            }
        }
    }
}