diff options
| author | Ben Beltran <ben@nsovocal.com> | 2015-09-28 12:39:59 -0500 |
|---|---|---|
| committer | Ben Beltran <ben@nsovocal.com> | 2015-09-28 12:39:59 -0500 |
| commit | 455f099b504ec07dd492ab31987ae05a6f6774c7 (patch) | |
| tree | 22b0c7fd8e492733b97e661750a2d79c46da451d /atom/packages/api-notation | |
| parent | 24c7594d62d8d7fbbcdb64b11ce4adc5d8e6991a (diff) | |
Adds atom packages
Diffstat (limited to 'atom/packages/api-notation')
| -rw-r--r-- | atom/packages/api-notation/.npmignore | 3 | ||||
| -rw-r--r-- | atom/packages/api-notation/CHANGELOG.md | 3 | ||||
| -rw-r--r-- | atom/packages/api-notation/LICENSE.md | 20 | ||||
| -rw-r--r-- | atom/packages/api-notation/README.md | 70 | ||||
| -rw-r--r-- | atom/packages/api-notation/example-syntax.api | 19 | ||||
| -rw-r--r-- | atom/packages/api-notation/grammars/api-notation.cson | 127 | ||||
| -rw-r--r-- | atom/packages/api-notation/package.json | 38 |
7 files changed, 280 insertions, 0 deletions
diff --git a/atom/packages/api-notation/.npmignore b/atom/packages/api-notation/.npmignore new file mode 100644 index 0000000..ade14b9 --- /dev/null +++ b/atom/packages/api-notation/.npmignore @@ -0,0 +1,3 @@ +.DS_Store +npm-debug.log +node_modules diff --git a/atom/packages/api-notation/CHANGELOG.md b/atom/packages/api-notation/CHANGELOG.md new file mode 100644 index 0000000..c3d858c --- /dev/null +++ b/atom/packages/api-notation/CHANGELOG.md @@ -0,0 +1,3 @@ +## 0.1.0 - First Release +* Every feature added +* Every bug fixed diff --git a/atom/packages/api-notation/LICENSE.md b/atom/packages/api-notation/LICENSE.md new file mode 100644 index 0000000..40a0eeb --- /dev/null +++ b/atom/packages/api-notation/LICENSE.md @@ -0,0 +1,20 @@ +Copyright (c) 2015 <Your name here> + +Permission is hereby granted, free of charge, to any person obtaining +a copy of this software and associated documentation files (the +"Software"), to deal in the Software without restriction, including +without limitation the rights to use, copy, modify, merge, publish, +distribute, sublicense, and/or sell copies of the Software, and to +permit persons to whom the Software is furnished to do so, subject to +the following conditions: + +The above copyright notice and this permission notice shall be +included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF +MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE +LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION +WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/atom/packages/api-notation/README.md b/atom/packages/api-notation/README.md new file mode 100644 index 0000000..45d61c0 --- /dev/null +++ b/atom/packages/api-notation/README.md @@ -0,0 +1,70 @@ +# API Notation Syntax for Atom + +This is a grammar for api notation, a simple notation I've been using for +annotating module APIs in specs and other documents. + +## Installing + +### From Command Line + +`apm install api-notation` + +### From GUI + +#### Open the Package Manager from Palette Manager + +1. Press `⌘⇧P` on OSX or `⌃⇧P` on Windows/Linux to open the palette manager +2. Look for `Install Packages and Themes` + +#### Open the Package Manager from Preferences + +1. Go to `Atom -> Preferences` menu +2. Go to `Install` + +#### Install it + +1. Search for `api-notation` in the search bar +2. Click Install + +## Usage + +Open a `.api` file, or set it as your syntax. + +## API Notation Reference + +The most recent reference as of now is in this [gist][api-reference], so +check that to be sure. But here's a reproduction of the notation. + +``` +NameOfClass.WithPossibleNamespace + + class property + - instance property + ~> listened events (socket) + +> listened events (class/module) + -> listened events (instance) + <~ dispatched events (socket) + <+ dispatched events(class/module) + <- dispatched events (instance) + :: class method + # instance method + +Other symbols + => returns +->() callback return +[xx] optional +<xx> data type + +Recommended order: class first, then sockets, then instance. Internally: +Properties, events, methods. + +// Anything after two forward slashes is a comment +``` + +## How does it look like? + +Like this. + +![Like this.][api-example] + +[api-reference]: https://gist.github.com/benbeltran/4694c46fcec131468e34 +[api-example]: https://i.imgur.com/5WXuf4u.png diff --git a/atom/packages/api-notation/example-syntax.api b/atom/packages/api-notation/example-syntax.api new file mode 100644 index 0000000..8c52870 --- /dev/null +++ b/atom/packages/api-notation/example-syntax.api @@ -0,0 +1,19 @@ +HypotheticalModule <IModuleInterface> + +staticProperty <String> + +anotherStaticProperty <Boolean> + ::toggleAnotherStaticProperty() + ::setStaticProperty(newValue <String>) + -instanceProperty <Number> + -anotherInstanceProperty <String> + #instanceMethodSync([optionalParameter]<Boolean>) => resultOfCall <String> + #instanceMethodAsync(someValue <Number>, [callback] <Function>) ->(error <String|null>, result <Number|null>) + + +// Comment +EventHypotheticalClass + +>AnotherClass<+staticEventToListen(eventData <PredefinedObject>) // More Comments + <+staticEventDispatched(someData <SomeData>) + ~>listenedSocketEvent(eventData <SomeObject>) + <~dispatchedSocketEvent(eventData <BlaBla>) + ->AnotherClass<-instanceEventToListen(eventData <Object>) + <-instanceEventDispatched(specificDataType <DefinedObject>) diff --git a/atom/packages/api-notation/grammars/api-notation.cson b/atom/packages/api-notation/grammars/api-notation.cson new file mode 100644 index 0000000..8a2b4de --- /dev/null +++ b/atom/packages/api-notation/grammars/api-notation.cson @@ -0,0 +1,127 @@ +'scopeName': 'source.api-notation' +'name': 'API Notation' +'fileTypes': [ + 'api' +] +'patterns': [ + { + 'begin': '^([a-zA-Z0-9_.]+)' + 'end': '\n' + 'name': 'constant.language' + 'patterns': [ + { + 'include': '#dataTypes' + } + { + 'include': '#comment' + } + ] + } + { + 'begin': '[ \t]*', + 'end': '\n' + 'patterns': [ + { + 'include': '#apiMember' + } + { + 'include': '#parameterList' + } + { + 'include': '#dataTypes' + } + { + 'include': '#operators' + } + { + 'include': '#parameters' + } + { + 'include': '#comment' + } + ] + } + { + 'begin': '^.', + 'end': '\n' + 'patterns': [ + { + 'include': '#comment' + } + ] + }, +] +'repository': + 'dataTypes': { + 'begin': '\\<' + 'end': '\\>' + 'name': 'keyword.operator' + 'patterns': [ + { + 'include': '#dataType' + } + { + 'include': '#separators' + } + ] + } + 'parameterList': { + 'begin': '\\(' + 'end': '\\)' + 'name': 'keyword.operator' + 'patterns': [ + { + 'include': '#parameters' + } + { + 'include': '#optionalParameters' + } + { + 'include': '#dataTypes' + } + { + 'include': '#separators' + } + ] + } + 'dataType': { + 'match': '[a-zA-Z0-9_.]+' + 'name': 'support.function' + } + 'parameters': { + 'match': '[a-zA-Z0-9_.]+' + 'name': 'string.other' + } + 'optionalParameters': { + 'begin': '\\[' + 'end': '\\]' + 'patterns': [ + { + 'include': '#optionalParameter' + } + ] + } + 'optionalParameter': { + 'match': '[a-zA-Z0-9_.]+' + 'name': 'meta.separator' + } + 'separators': { + 'match': '\\||,' + 'name': 'comment.line' + } + 'apiMember': { + 'match': '((?:<\\+)|(?:<\\~)|(?:<\\-)|(?:\\+>)|(?:\\~>)|(?:\\->)|\\-|\\+|(?:::)|#)([a-zA-z0-9_]+)' + 'captures': + '1': + 'name': 'keyword.control' + '2': + 'name': 'variable.language' + } + 'comment': { + 'match': '[ \t]*//[ \t]*.*', + 'name': 'comment.line' + } + 'operators': { + 'match': '(?:\\->)|(?:\\=>)' + 'name': 'keyword.control' + } diff --git a/atom/packages/api-notation/package.json b/atom/packages/api-notation/package.json new file mode 100644 index 0000000..480422f --- /dev/null +++ b/atom/packages/api-notation/package.json @@ -0,0 +1,38 @@ +{ + "name": "api-notation", + "version": "1.0.2", + "description": "Syntax for API Notation, a simple shorthand to write library APIs", + "keywords": [ + "syntax", + "theme", + "api" + ], + "repository": { + "type": "git", + "url": "git+https://github.com/rbdr/api-notation-atom.git" + }, + "license": "MIT", + "engines": { + "atom": ">=1.0.0 <2.0.0" + }, + "readme": "# API Notation Syntax for Atom\n\nThis is a grammar for api notation, a simple notation I've been using for\nannotating module APIs in specs and other documents.\n\n## Installing\n\n### From Command Line\n\n`apm install api-notation`\n\n### From GUI\n\n#### Open the Package Manager from Palette Manager\n\n1. Press `⌘⇧P` on OSX or `⌃⇧P` on Windows/Linux to open the palette manager\n2. Look for `Install Packages and Themes`\n\n#### Open the Package Manager from Preferences\n\n1. Go to `Atom -> Preferences` menu\n2. Go to `Install`\n\n#### Install it\n\n1. Search for `api-notation` in the search bar\n2. Click Install\n\n## Usage\n\nOpen a `.api` file, or set it as your syntax.\n\n## API Notation Reference\n\nThe most recent reference as of now is in this [gist][api-reference], so\ncheck that to be sure. But here's a reproduction of the notation.\n\n```\nNameOfClass.WithPossibleNamespace\n + class property\n - instance property\n ~> listened events (socket)\n +> listened events (class/module)\n -> listened events (instance)\n <~ dispatched events (socket)\n <+ dispatched events(class/module)\n <- dispatched events (instance)\n :: class method\n # instance method\n\nOther symbols\n => returns\n->() callback return\n[xx] optional\n<xx> data type\n\nRecommended order: class first, then sockets, then instance. Internally:\nProperties, events, methods.\n\n// Anything after two forward slashes is a comment\n```\n\n## How does it look like?\n\nLike this.\n\n![Like this.][api-example]\n\n[api-reference]: https://gist.github.com/benbeltran/4694c46fcec131468e34\n[api-example]: https://i.imgur.com/5WXuf4u.png\n", + "readmeFilename": "README.md", + "bugs": { + "url": "https://github.com/rbdr/api-notation-atom/issues" + }, + "homepage": "https://github.com/rbdr/api-notation-atom#readme", + "_id": "api-notation@1.0.2", + "_shasum": "307b0647acce54c74350a9d1257fae9ef9c964cd", + "_resolved": "file:../d-115828-94250-r4fn9v/package.tgz", + "_from": "../d-115828-94250-r4fn9v/package.tgz", + "_atomModuleCache": { + "version": 1, + "dependencies": [], + "extensions": { + ".json": [ + "package.json" + ] + }, + "folders": [] + } +}
\ No newline at end of file |