基本言語 is by far the most widely extended language in MPS. Since it is very likely that a typical MPS project will use a lot of different extensions from different sources or language vendors, the community might benefit from having a unified style across all languages. In this document we describe the conventions that creators should apply to all 基本言語 extensions.
If you use...
Set its style to...
= + - * / % ++ -- ! == != > >= < <= && || ?: (ternary) ~ << >> >>> & ^ | :eq: :ne:
@interface abstract assert boolean break byte case catch char class const continue default do double else enum extends false final finally float for get goto if implements import instanceof int interface long native new null package private protected public return set short static strictfp super switch synchronized this throw throws transient try true void volatile while
A keyword is a widely used string, which identifies important concepts from a language. For example, all the primitive types from 基本言語 are keywords. Also names of statements such as ifStatement, forStatement are keywords. Use the KeyWord style from base language's stylesheet for keywords.
Curly braces are often used to demarcate a block of code inside of a containing construction. If you create an if-like construct, place opening curly brace on the same line as the construct header. I.e. use:
Use the LeftBrace and RightBrace styles to set correct offsets. Make sure that the space between a character which is to left to opening curly brace and the curly brace itself is equal to 1 space. You can do so with a help of padding-left/padding-right styles.
When you use parentheses, set the LeftParen/RightParen styles to the left/right parenthesis. If a parenthesis cell's sibling is a named node's property, disable the first/last position of a parenthesis with first/last-position-allowed style.
When you use named nodes: methods, variables, fields, etc, it's advisable to make their name properties have 0 left and right padding. Making identifier declaration and reference holding the same color is also a good idea. For example, in Base Language, field declarations and references have the same color.
If you have a semicolon somewhere, set its style to セミコロン . If you have a dot, use the ドット style. If you have a binary operator, use the 演算子 style for it.