Skip to content

dehilsterlexis/pike-for-sublime

This branch is 4 commits behind poppa/pike-for-sublime:master.

Folders and files

NameName
Last commit message
Last commit date

Latest commit

2c3252a · Oct 27, 2016

History

82 Commits
Oct 8, 2016
Oct 27, 2016
Dec 1, 2014
May 7, 2013
Oct 14, 2013
Mar 20, 2015
Jan 21, 2016
Oct 27, 2016
Oct 27, 2016
Jan 13, 2016
Jan 13, 2016
Jan 21, 2016
Mar 19, 2015
Jan 16, 2015
Dec 1, 2014

Repository files navigation

Pike syntax bundle for Sublime Text

This is an attempt to add syntax definition, snippets and some other functionality for Pike to Sublime Text.

Pike mode in Sublime

Installation

Using Sublime Package Control (and get automatic updates):

  • ctrl+shft+p then select Package Control: Add Repository
  • Supply the web URL for this repository: https://github.com/poppa/pike-for-sublime
  • ctrl+shft+p then select Package Control: Install Package
  • Install pike-for-sublime

Alternatively, download or clone the package from GitHub into your Packages/User folder.

Contributing

Sublime uses XML files for the syntax defintions but that's rather tiresome to write. The Pike syntax definition is written in a JSON (-like) format which then is runt through to-tmlanguage which creates an XML file. (Why use AAAPackageDev when it can be done with Pike ;-)

I've added some stuff to the JSON format just to make the file easier to read. The file is then normalized before being passed to the JSON parser.

JSON addition

  • Comments: The JSON file can be commented with the prefix //-.
    NOTE! There can not be anything else but the comment on a line.

    Now, we also support block comments /* The comment */

  • Multiline strings: Some regexp are seriously long which makes them difficult to read. A string can be split by ending the line with a backslash. NOTE! Each line must be quoted though! Or you can write a real multiline string in the same manner as you write a regular Pike multiline string.

Example

//- This is a comment to the JSON file
//- Each comment must be standing alone on a line.

{ "key" : "value",
  "lng" : "A string can be split into " \
          "multiple lines by ening a line with " \
          "a backslash. Note also that no whitespace " \
          "is allowed after the backslash",
  "john" : "doe" }
  
{ "key" : "value",
  "lng" : #"This is a real multiline string
           which will preserve the 
           whitespace as well in the resulting
           XML file",
  "john" : "doe" }

Todo

  • #define MACRO(A1,A1) func_call(A1, fun(A2)) doesn't get parsed properly

  • Class methods with parenthesis in the return type doesn't get parsed properly

    class Test {
      int(0..1) method() { return 1; }
    }
    

    Here method is colorized as a function call. This only happens to methods within a class definition.

  • There's something fishy going on with #define macro func(). It gets scrambled after that.

  • Calls to special Pike methods like \` does not get the correct color.

About

Pike syntax definition for the Sublime text editor

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Pike 100.0%