MPS 2019.1ヘルプ

基本言語拡張スタイルガイド

基本言語 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.

Quick Reference

If you use...

Set its style to...

.

ドット

[

LeftBracket

]

RightBracket

{

LeftBrace

}

RightBrace

= + - * / % ++ -- ! == != > >= < <= && || ?: (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

KeyWord

キーワード

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:

abc { code }

の代わりに

abc { code }

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.

基本言語 クロージャー

最終更新日: 2019年4月12日