Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
src/lexer.c linguist-generated
12 changes: 12 additions & 0 deletions docs/syntax.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,18 @@ _proc_ ::= `^` _parameters?_ _self-type-binding?_ _block?_ `->` _type_
| `^` `(` `?` `)` `->` _type_ # Proc type with untyped parameter
```

`\w` above, and everywhere else in this document, is `[a-zA-Z0-9_]` together
with every character outside ASCII -- the same set Ruby takes into an
identifier. So `ServicioÚltimaVez` is a class name and `nombre_único` is an
alias name.

The leading character is the exception. RBS reads it to tell a class name from
an interface name from an alias name, so where it makes that distinction it has
to be ASCII: `class 日本語` is a class in Ruby but not a name RBS can write.
Nowhere else is restricted -- a method name, a variable name, an instance
variable name and a class variable name may all open with any character Ruby
accepts.

### Class instance type

Class instance type denotes _an instance of a class_.
Expand Down
25 changes: 13 additions & 12 deletions include/rbs/lexer.h
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,19 @@ enum RBSTokenType {
kRETURN, /* return */
kMODULESELF, /* module-self */

tLIDENT, /* Identifiers starting with lower case */
tUIDENT, /* Identifiers starting with upper case */
tULIDENT, /* Identifiers starting with `_` followed by upper case */
tULLIDENT, /* Identifiers starting with `_` followed by lower case */
tGIDENT, /* Identifiers starting with `$` */
tAIDENT, /* Identifiers starting with `@` */
tA2IDENT, /* Identifiers starting with `@@` */
tBANGIDENT, /* Identifiers ending with `!` */
tEQIDENT, /* Identifiers ending with `=` */
tQIDENT, /* Quoted identifier */
pAREF_OPR, /* [] */
tOPERATOR, /* Operator identifier */
tLIDENT, /* Identifiers starting with lower case */
tUIDENT, /* Identifiers starting with upper case */
tULIDENT, /* Identifiers starting with `_` followed by upper case */
tULLIDENT, /* Identifiers starting with `_` followed by lower case */
tNONASCIIIDENT, /* Identifiers starting with a character outside ASCII */
tGIDENT, /* Identifiers starting with `$` */
tAIDENT, /* Identifiers starting with `@` */
tA2IDENT, /* Identifiers starting with `@@` */
tBANGIDENT, /* Identifiers ending with `!` */
tEQIDENT, /* Identifiers ending with `=` */
tQIDENT, /* Quoted identifier */
pAREF_OPR, /* [] */
tOPERATOR, /* Operator identifier */

tCOMMENT, /* Comment */
tLINECOMMENT, /* Comment of all line */
Expand Down
Loading
Loading