Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
shnhrrsn committed Jul 16, 2017
0 parents commit 8d62989
Show file tree
Hide file tree
Showing 4 changed files with 248 additions and 0 deletions.
42 changes: 42 additions & 0 deletions Comments.tmPreferences
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>name</key>
<string>Comments</string>
<key>scope</key>
<string>text.html.stone, source.js.stone, custom.compiler.stone.js</string>
<key>settings</key>
<dict>
<key>shellVariables</key>
<array>
<dict>
<key>name</key>
<string>TM_COMMENT_START</string>
<key>value</key>
<string>{{-- </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END</string>
<key>value</key>
<string> --}}</string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_START_2</string>
<key>value</key>
<string>&lt;!-- </string>
</dict>
<dict>
<key>name</key>
<string>TM_COMMENT_END_2</string>
<key>value</key>
<string> --&gt;</string>
</dict>
</array>
</dict>
<key>uuid</key>
<string>725f59db-0615-49e0-b206-f9574e1db5ec</string>
</dict>
</plist>
3 changes: 3 additions & 0 deletions README.markdown
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## Grind Stone Syntax Highlighter for Sublime

This package adds syntax definitions to Sublime for the [Grind](https://grind.rocks) Stone engine. This package has been adapted from [Medalink/laravel-blade](https://github.com/Medalink/laravel-blade).
87 changes: 87 additions & 0 deletions grind-stone.sublime-syntax
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
%YAML 1.2
---
name: Grind Stone
file_extensions: [ stone ]
scope: text.stone
contexts:
main:
- match: ''
push:
- include: 'scope:text.html.basic'
- meta_scope: text.html.stone
pop: true
with_prototype:

- match: '{{--'
captures:
0: punctuation.definition.comment.begin.stone
push:
- meta_scope: comment.block.html.stone
- match: '--}}'
scope: punctuation.definition.comment.end.stone
pop: true
- match: "--"
scope: invalid.illegal.bad-comments-or-CDATA.html.stone

- match: '\{(!!)|(\{\{)-?'
captures:
0: punctuation.section.embedded.begin.stone
push:
- meta_scope: entity.name.tag.stone
- meta_content_scope: source.js.stone
- match: '-?(\}?\}\})|(!!)\}'
captures:
0: punctuation.section.embedded.end.stone
1: punctuation.section.embedded.end.stone
pop: true
- include: 'scope:source.js'

- match: '@\{\{\{?-?'
captures:
0: punctuation.section.embedded.ignore.begin.stone
push:
- meta_scope: 'scope:text.html.basic'
- meta_content_scope: 'scope:text.html.basic'
- match: '-?\}?\}\}'
captures:
0: punctuation.section.embedded.ignore.end.stone
1: punctuation.section.embedded.ignore.end.stone
pop: true

- match: '(\s{0}|^)(\@)\b(asset|babel|block|break|coffee|component|continue|css|debug|dump|each|elseif|extends|for|foreach|forelse|hasSection|if|include|js|layout|less|macro|push|sass|scss|script|section|set|slot|stack|styl|style|stylus|unless|while|yield)\b(?=(|\s*|)\()'
captures:
0: punctuation.section.embedded.js
2: keyword.control.flow.js
3: keyword.control.flow.js
push:
- meta_scope: custom.compiler.stone.js
- meta_content_scope: source.js.stone
- match: '(?<=\))'
pop: true
- include: 'scope:source.js'

- match: '(\s{0}|^)(\@)\b(break|continue|else|empty|endblock|endcomponent|endfor|endforeach|endforelse|endif|endmacro|endpush|endsection|endslot|endspaceless|endunless|endwhile|parent|setup|show|spaceless|super)\b'
scope: custom.compiler.stone.js
captures:
0: punctuation.section.embedded.js
2: keyword.control.flow.js
3: keyword.control.flow.js
pop: false

- match: '(\s{0}|^)(\@)\b([a-zA-Z_]+)\b(?=(|\s*|)\()'
captures:
0: support.function
2: constant.other.inline-data.html
push:
- meta_scope: custom.compiler.stone.js
- meta_content_scope: source.js.stone
- match: '(?<=\))'
pop: true
- include: 'scope:source.js'

- match: '(\s{0}|^)(\@)\b([a-zA-Z_]+)\b(\s?)\b'
scope: custom.compiler.stone.js
captures:
0: support.function
2: constant.other.inline-data.html
pop: false
116 changes: 116 additions & 0 deletions test.stone
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
{{-- Output Data --}}
Hello, {{ name }}.
The current UNIX timestamp is {{ Date.now() }}.

{{-- Outputting Data After Checking For Existence --}}
{{ name || 'Default' }}

{{-- Displaying Raw Text With Curly Braces --}}
@{{ This will 'not be processed' <strong>by Grind</strong> }}

{{-- Do not escape data --}}
Hello, {!! name || '<i>Default</i>' !!}.

@include('header')

@include('footer')

@macro('a')
@endmacro

{{-- Define Grind Layout --}}
<html>
<head>
<title>
@hasSection('title')
@yield('title') - App Name
@else
App Name
@endif
</title>
</head>
<body>
@section('sidebar')
This is the master sidebar.
@endsection

<div class="container">
@yield('content')
</div>
</body>
</html>

{{-- Use Grind Layout --}}
@extends('layouts.master')

@section('sidebar')
<p>This is appended to the master sidebar.</p>
@endsection

@section('content')
@super
<p>This is my body content.</p>
@endsection

{{-- yield section --}}
@yield('section', 'Default Content')

{{-- If Statement --}}
@if(records.length === 1)
I have one record!
@elseif(records.length > 1)
I have multiple records!
@else
I don't have any records!
@endif

@unless(Auth.check())
You are not signed in.
@endunless

{{-- Loops --}}
@for(let i = 0; i < 10; i++)
The current value is {{ i }}
@endfor

@for(const user of users)
<p>This is user {{ user.id }}</p>
@endforeach

@forelse(const user of users)
<li>{{ user.name }}</li>
@empty
<p>No users</p>
@endforelse

@while(true)
<p>I'm looping forever.</p>
@endwhile

{{-- Include --}}
@include('view.name')
@include('view.name', { some: 'data' })

{{-- Overwriting Sections --}}
@extends('list.item.container')

@section('list.item.content')
<p>This is an item of type {{ item.type }}</p>
@overwrite

{{-- This comment will not be in the rendered HTML --}}

{{--
This comment will not be in the rendered HTML
This comment will not be in the rendered HTML
This comment will not be in the rendered HTML
--}}

{{-- Stacks --}}
@push('scripts')
<script src="/example.js"></script>
@endpush

<head>
@stack('scripts')
</head>

0 comments on commit 8d62989

Please sign in to comment.