328 строки
20 KiB
Plaintext
328 строки
20 KiB
Plaintext
original file
|
|
-----------------------------------
|
|
import {Component, HostListener, Directive} from 'angular2/core';
|
|
|
|
@Directive({selector: 'button[counting]'})
|
|
class CountClicks {
|
|
numberOfClicks = 0;
|
|
@HostListener('click', ['$event.target']) onClick(btn) {
|
|
console.log("button", btn, "number of clicks:", this.numberOfClicks++);
|
|
}
|
|
}
|
|
@Component({
|
|
selector: 'my-app',
|
|
template: `<button counting>Increment</button>`,
|
|
directives: [CountClicks]
|
|
})
|
|
export class AppComponent {
|
|
constructor() { console.clear(); }
|
|
}
|
|
-----------------------------------
|
|
|
|
Grammar: TypeScript.tmLanguage
|
|
-----------------------------------
|
|
>import {Component, HostListener, Directive} from 'angular2/core';
|
|
^^^^^^
|
|
source.ts meta.import.ts keyword.control.import.ts
|
|
^
|
|
source.ts meta.import.ts
|
|
^
|
|
source.ts meta.import.ts meta.block.ts punctuation.definition.block.ts
|
|
^^^^^^^^^
|
|
source.ts meta.import.ts meta.block.ts variable.other.readwrite.alias.ts
|
|
^
|
|
source.ts meta.import.ts meta.block.ts punctuation.separator.comma.ts
|
|
^
|
|
source.ts meta.import.ts meta.block.ts
|
|
^^^^^^^^^^^^
|
|
source.ts meta.import.ts meta.block.ts variable.other.readwrite.alias.ts
|
|
^
|
|
source.ts meta.import.ts meta.block.ts punctuation.separator.comma.ts
|
|
^
|
|
source.ts meta.import.ts meta.block.ts
|
|
^^^^^^^^^
|
|
source.ts meta.import.ts meta.block.ts variable.other.readwrite.alias.ts
|
|
^
|
|
source.ts meta.import.ts meta.block.ts punctuation.definition.block.ts
|
|
^
|
|
source.ts meta.import.ts
|
|
^^^^
|
|
source.ts meta.import.ts keyword.control.from.ts
|
|
^
|
|
source.ts meta.import.ts
|
|
^
|
|
source.ts meta.import.ts string.quoted.single.ts punctuation.definition.string.begin.ts
|
|
^^^^^^^^^^^^^
|
|
source.ts meta.import.ts string.quoted.single.ts
|
|
^
|
|
source.ts meta.import.ts string.quoted.single.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts punctuation.terminator.statement.ts
|
|
>
|
|
^
|
|
source.ts
|
|
>@Directive({selector: 'button[counting]'})
|
|
^
|
|
source.ts meta.decorator.ts punctuation.decorator.ts
|
|
^^^^^^^^^
|
|
source.ts meta.decorator.ts meta.function-call.ts entity.name.function.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts punctuation.definition.block.ts
|
|
^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.quoted.single.ts punctuation.definition.string.begin.ts
|
|
^^^^^^^^^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.quoted.single.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.quoted.single.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts punctuation.definition.block.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.brace.round.ts
|
|
>class CountClicks {
|
|
^^^^^
|
|
source.ts meta.class.ts storage.type.class.ts
|
|
^
|
|
source.ts meta.class.ts
|
|
^^^^^^^^^^^
|
|
source.ts meta.class.ts entity.name.type.class.ts
|
|
^
|
|
source.ts meta.class.ts
|
|
^
|
|
source.ts meta.class.ts punctuation.definition.block.ts
|
|
> numberOfClicks = 0;
|
|
^^
|
|
source.ts meta.class.ts meta.field.declaration.ts
|
|
^^^^^^^^^^^^^^
|
|
source.ts meta.class.ts meta.field.declaration.ts meta.definition.property.ts variable.object.property.ts
|
|
^
|
|
source.ts meta.class.ts meta.field.declaration.ts
|
|
^
|
|
source.ts meta.class.ts meta.field.declaration.ts keyword.operator.assignment.ts
|
|
^
|
|
source.ts meta.class.ts meta.field.declaration.ts
|
|
^
|
|
source.ts meta.class.ts meta.field.declaration.ts constant.numeric.decimal.ts
|
|
^
|
|
source.ts meta.class.ts punctuation.terminator.statement.ts
|
|
> @HostListener('click', ['$event.target']) onClick(btn) {
|
|
^^
|
|
source.ts meta.class.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts punctuation.decorator.ts
|
|
^^^^^^^^^^^^
|
|
source.ts meta.class.ts meta.decorator.ts meta.function-call.ts entity.name.function.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts string.quoted.single.ts punctuation.definition.string.begin.ts
|
|
^^^^^
|
|
source.ts meta.class.ts meta.decorator.ts string.quoted.single.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts string.quoted.single.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts punctuation.separator.comma.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.array.literal.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.array.literal.ts meta.brace.square.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.begin.ts
|
|
^^^^^^^^^^^^^
|
|
source.ts meta.class.ts meta.decorator.ts meta.array.literal.ts string.quoted.single.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.array.literal.ts string.quoted.single.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.array.literal.ts meta.brace.square.ts
|
|
^
|
|
source.ts meta.class.ts meta.decorator.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts
|
|
^^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.definition.method.ts entity.name.function.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
|
|
^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts variable.parameter.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.end.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts
|
|
> console.log("button", btn, "number of clicks:", this.numberOfClicks++);
|
|
^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.function-call.ts support.class.console.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.function-call.ts punctuation.accessor.ts
|
|
^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.function-call.ts support.function.console.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts string.quoted.double.ts punctuation.definition.string.begin.ts
|
|
^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts string.quoted.double.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts string.quoted.double.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.separator.comma.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts variable.other.readwrite.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.separator.comma.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts string.quoted.double.ts punctuation.definition.string.begin.ts
|
|
^^^^^^^^^^^^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts string.quoted.double.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts string.quoted.double.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.separator.comma.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts variable.language.this.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.accessor.ts
|
|
^^^^^^^^^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts variable.other.property.ts
|
|
^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts keyword.operator.increment.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.terminator.statement.ts
|
|
> }
|
|
^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts
|
|
>}
|
|
^
|
|
source.ts meta.class.ts punctuation.definition.block.ts
|
|
>@Component({
|
|
^
|
|
source.ts meta.decorator.ts punctuation.decorator.ts
|
|
^^^^^^^^^
|
|
source.ts meta.decorator.ts meta.function-call.ts entity.name.function.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts punctuation.definition.block.ts
|
|
> selector: 'my-app',
|
|
^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts
|
|
^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.quoted.single.ts punctuation.definition.string.begin.ts
|
|
^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.quoted.single.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.quoted.single.ts punctuation.definition.string.end.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts punctuation.separator.comma.ts
|
|
> template: `<button counting>Increment</button>`,
|
|
^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts
|
|
^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.template.ts punctuation.definition.string.template.begin.ts
|
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.template.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts string.template.ts punctuation.definition.string.template.end.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts punctuation.separator.comma.ts
|
|
> directives: [CountClicks]
|
|
^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts
|
|
^^^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.object-literal.key.ts punctuation.separator.key-value.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.array.literal.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.array.literal.ts meta.brace.square.ts
|
|
^^^^^^^^^^^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.array.literal.ts variable.other.readwrite.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts meta.object.member.ts meta.array.literal.ts meta.brace.square.ts
|
|
>})
|
|
^
|
|
source.ts meta.decorator.ts meta.objectliteral.ts punctuation.definition.block.ts
|
|
^
|
|
source.ts meta.decorator.ts meta.brace.round.ts
|
|
>export class AppComponent {
|
|
^^^^^^
|
|
source.ts meta.class.ts keyword.control.export.ts
|
|
^
|
|
source.ts meta.class.ts
|
|
^^^^^
|
|
source.ts meta.class.ts storage.type.class.ts
|
|
^
|
|
source.ts meta.class.ts
|
|
^^^^^^^^^^^^
|
|
source.ts meta.class.ts entity.name.type.class.ts
|
|
^
|
|
source.ts meta.class.ts
|
|
^
|
|
source.ts meta.class.ts punctuation.definition.block.ts
|
|
> constructor() { console.clear(); }
|
|
^^
|
|
source.ts meta.class.ts meta.method.declaration.ts
|
|
^^^^^^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts storage.type.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.begin.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.parameters.ts punctuation.definition.parameters.end.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^^^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.function-call.ts support.class.console.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.function-call.ts punctuation.accessor.ts
|
|
^^^^^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.function-call.ts support.function.console.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts meta.brace.round.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.terminator.statement.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts
|
|
^
|
|
source.ts meta.class.ts meta.method.declaration.ts meta.block.ts punctuation.definition.block.ts
|
|
>}
|
|
^
|
|
source.ts meta.class.ts punctuation.definition.block.ts |