Created
November 19, 2014 06:28
-
-
Save angelacode/fc4db433d4c0a7bde9db to your computer and use it in GitHub Desktop.
Textmate Syntax for Haml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ patterns = ( | |
{ begin = '^\s*=='; | |
end = '$\n?'; | |
contentName = 'string.quoted.double.ruby'; | |
patterns = ( { include = '#interpolated_ruby'; } ); | |
}, | |
{ name = 'meta.prolog.haml'; | |
match = '^(!!!)($|\s.*)'; | |
captures = { 1 = { name = 'punctuation.definition.prolog.haml'; }; }; | |
}, | |
{ name = 'comment.line.slash.haml'; | |
match = '^ *(/)\s*\S.*$\n?'; | |
captures = { 1 = { name = 'punctuation.section.comment.haml'; }; }; | |
}, | |
{ name = 'comment.block.haml'; | |
begin = '^( *)(/)\s*$'; | |
end = '^(?!\1 )'; | |
beginCaptures = { 2 = { name = 'punctuation.section.comment.haml'; }; }; | |
patterns = ( { include = 'text.haml'; } ); | |
}, | |
{ name = 'source.coffee.embedded.filter.haml'; | |
begin = '^(\s*):coffee(script)?$'; | |
end = '^(?!\1\s)'; | |
patterns = ( { include = 'source.coffee'; } ); | |
}, | |
{ name = 'source.scss.embedded.filter.haml'; | |
begin = '^(\s*):scss$'; | |
end = '^(?!\1\s)'; | |
patterns = ( { include = 'source.scss'; } ); | |
}, | |
{ name = 'source.css.embedded.filter.haml'; | |
begin = '^(\s*):css$'; | |
end = '^(?!\1\s)'; | |
patterns = ( { include = 'source.css'; } ); | |
}, | |
{ name = 'source.js.embedded.filter.haml'; | |
begin = '^(\s*):javascript$'; | |
end = '^(?!\1\s)'; | |
patterns = ( { include = 'source.js'; } ); | |
}, | |
{ begin = '^\s*(?:((%)([\w:]+))|(?=\.|#))'; | |
end = '$|(?!\.|#|\{|\[|=|-|~|/)'; | |
captures = { | |
1 = { name = 'meta.tag.haml'; }; | |
2 = { name = 'punctuation.definition.tag.haml'; }; | |
3 = { name = 'entity.name.tag.haml'; }; | |
}; | |
patterns = ( | |
{ begin = '=='; | |
end = '$\n?'; | |
contentName = 'string.quoted.double.ruby'; | |
patterns = ( { include = '#interpolated_ruby'; } ); | |
}, | |
{ name = 'entity.name.tag.class.haml'; | |
match = '\.[\w-]+'; | |
}, | |
{ name = 'entity.name.tag.id.haml'; | |
match = '#[\w-]+'; | |
}, | |
{ name = 'meta.section.attributes.haml'; | |
begin = '\{(?=.*\}|.*\|\s*$)'; | |
end = '\}|$|^(?!.*\|\s*$)'; | |
patterns = ( | |
{ include = 'source.ruby.rails'; }, | |
{ include = '#continuation'; }, | |
); | |
}, | |
{ name = 'meta.section.object.haml'; | |
begin = '\[(?=.*\]|.*\|\s*$)'; | |
end = '\]|$|^(?!.*\|\s*$)'; | |
patterns = ( | |
{ include = 'source.ruby.rails'; }, | |
{ include = '#continuation'; }, | |
); | |
}, | |
{ include = '#rubyline'; }, | |
{ name = 'punctuation.terminator.tag.haml'; | |
match = '/'; | |
}, | |
); | |
}, | |
{ match = '^\s*(\\.)'; | |
captures = { 1 = { name = 'meta.escape.haml'; }; }; | |
}, | |
{ begin = '^\s*(?==|-|~)'; | |
end = '$'; | |
patterns = ( { include = '#rubyline'; } ); | |
}, | |
); | |
repository = { | |
continuation = { | |
match = '(\|)\s*\n'; | |
captures = { 1 = { name = 'punctuation.separator.continuation.haml'; }; }; | |
}; | |
interpolated_ruby = { | |
patterns = ( | |
{ name = 'source.ruby.embedded.source'; | |
match = '#\{(\})'; | |
captures = { | |
0 = { name = 'punctuation.section.embedded.ruby'; }; | |
1 = { name = 'source.ruby.embedded.source.empty'; }; | |
}; | |
}, | |
{ name = 'source.ruby.embedded.source'; | |
begin = '#\{'; | |
end = '(\})'; | |
captures = { 0 = { name = 'punctuation.section.embedded.ruby'; }; }; | |
patterns = ( | |
{ include = '#nest_curly_and_self'; }, | |
{ include = 'source.ruby'; }, | |
); | |
}, | |
{ name = 'variable.other.readwrite.instance.ruby'; | |
match = '(#@)[a-zA-Z_]\w*'; | |
captures = { 1 = { name = 'punctuation.definition.variable.ruby'; }; }; | |
}, | |
{ name = 'variable.other.readwrite.class.ruby'; | |
match = '(#@@)[a-zA-Z_]\w*'; | |
captures = { 1 = { name = 'punctuation.definition.variable.ruby'; }; }; | |
}, | |
{ name = 'variable.other.readwrite.global.ruby'; | |
match = '(#\$)[a-zA-Z_]\w*'; | |
captures = { 1 = { name = 'punctuation.definition.variable.ruby'; }; }; | |
}, | |
); | |
}; | |
nest_curly_and_self = { | |
patterns = ( | |
{ begin = '\{'; | |
end = '\}'; | |
captures = { 0 = { name = 'punctuation.section.scope.ruby'; }; }; | |
patterns = ( { include = '#nest_curly_and_self'; } ); | |
}, | |
{ include = 'source.ruby'; }, | |
); | |
}; | |
rubyline = { | |
name = 'meta.line.ruby.haml'; | |
begin = '=|-|~'; | |
end = '((do|\{)( \|[^|]+\|)?)$|$|^(?!.*\|\s*$)'; | |
endCaptures = { | |
1 = { name = 'source.ruby.embedded.html'; }; | |
2 = { name = 'keyword.control.ruby.start-block'; }; | |
}; | |
contentName = 'source.ruby.embedded.haml'; | |
patterns = ( | |
{ name = 'comment.line.number-sign.ruby'; | |
comment = 'Hack to let ruby comments work in this context properly'; | |
match = '#.*$'; | |
}, | |
{ include = 'source.ruby.rails'; }, | |
{ include = '#continuation'; }, | |
); | |
}; | |
}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment