Skip to content
Snippets Groups Projects
Commit 817ce563 authored by Jeffrey Phillips Freeman's avatar Jeffrey Phillips Freeman
Browse files

Initial commit for pseudocode highlighter.

parents
No related branches found
No related tags found
No related merge requests found
# Created by .ignore support plugin (hsz.mobi)
### JetBrains template
# Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm
*.iml
## Directory-based project format:
.idea/
# if you remove the above rule, at least ignore the following:
# User-specific stuff:
# .idea/workspace.xml
# .idea/tasks.xml
# .idea/dictionaries
# Sensitive or high-churn files:
# .idea/dataSources.ids
# .idea/dataSources.xml
# .idea/sqlDataSources.xml
# .idea/dynamic.xml
# .idea/uiDesigner.xml
# Gradle:
# .idea/gradle.xml
# .idea/libraries
# Mongo Explorer plugin:
# .idea/mongoSettings.xml
## File-based project format:
*.ipr
*.iws
## Plugin-specific files:
# IntelliJ
out/
# mpeltonen/sbt-idea plugin
.idea_modules/
# JIRA plugin
atlassian-ide-plugin.xml
# Crashlytics plugin (for Android Studio and IntelliJ)
com_crashlytics_export_strings.xml
crashlytics.properties
crashlytics-build.properties
README.md 0 → 100644
# language-pseudocode package
Have you ever tried to explain an algorithm on a presentation or document and felt the lack of having a standard to
write pseudocode? Well, this Atom package is a syntax highlighter for a pseudocode language.
*It is still in development and open for new contributors.*
![Screen](imgs/print.png)
## Install
- Install [Atom editor](https://atom.io/)
- cd ~/.atom/packages
- git clone
## Usage
- Open Atom Editor
- Create a file called hello.pseudo
- Learn the language by the examples here
## Language examples
Here you can see some examples. The language is still not complete but can be enough just to write
simple algorithms.
### 1. For
FOR each component in commit
component.revisions_twr += twr
IF is_bug_fix(commit) THEN
component.fixes_twr += twr
ENDIF
IF is_new_author(component, commit.author) THEN
component.authors_twr += twr
ENDIF
ENDFOR
### 2. While
counter = 0
WHILE counter < 10
counter += 1
print(counter)
ENDWHILE
### 3. Function
FUNCTION twr(ti)
RETURN 1 / (1 + e ^ ( -12 * ti + 12) )
ENDFUNCTION
### 4. Class
CLASS person
name
email
FUNCTION person(name, email)
this.name = name
this.email = email
ENDFUNCTION
ENDCLASS
### 5. Abstract Classes
ABSTRACT CLASS Data
URL
FUNCTION load(filter, callback)
loadStored(filter, callback)
sync(filter, callback)
ENDFUNCTION
FUNCTION loadStored(filter, callback)
entities = query(filter)
callback(entities)
ENDFUNCTION
FUNCTION sync(filter, callback)
entities = request(filter, callback)
store(entities)
callback(entities)
ENDFUNCTION
FUNCTION ABSTRACT query(filter) // Local database query
FUNCTION ABSTRACT store(entities) // Saves entities on local database
FUNCTION ABSTRACT request(filter, callback) // API async JSON request
ENDCLASS
CLASS IterationsData EXTENDS DataInterface
FUNCTION query(filter)
(...)
ENDFUNCTION
FUNCTION store(entities)
(...)
ENDFUNCTION
FUNCTION request(filter)
(...)
ENDFUNCTION
ENDCLASS
### 6. Optional typing
CLASS person
string name
int age
float weight
FUNCTION person(string name, int age, float weight)
this.name = name
this.age = age
this.weight = weight
ENDFUNCTION
ENDCLASS
### 7. Structures
list numbers = [1,2,3]
set lights = {"green", "red", "yellow"}
map person = {name: "Carlos", age: 12}
fileTypes: [
"pseudocode"
"pseudo"
"pso"
]
foldingStartMarker: "/\\*\\*|\\{\\s*$"
foldingStopMarker: "\\*\\*/|^\\s*\\}"
name: "pseudocode"
patterns: [
{
'match': '(END)?FOR'
'name': 'keyword.control.pseudocode'
},
{
'match': '(END)?WHILE'
'name': 'keyword.control.pseudocode'
},
{
'match': '(END)?IF|THEN|ELSE'
'name': 'keyword.control.pseudocode'
},
{
'match': '(END)?FUNCTION'
'name': 'entity.name.function.pseudocode'
},
{
'match': 'RETURN'
'name': 'entity.name.section.pseudocode'
},
{
'match': '(END)?CLASS'
'name': 'entity.name.type.pseudocode'
},
{
'match': 'EXTENDS|ABSTRACT'
'name': 'entity.name.tag.pseudocode'
},
{
'match': 'this'
'name': 'support.variable.pseudocode'
},
{
'match': 'print'
'name': 'support.function.pseudocode'
},
{
'match': 'string|int|float|map|list|set'
'name': 'storage.type.language.pseudocode'
},
{
match: "(([\\<\\=]|[\\>\\=]|[\\<\\>]|[\\=\\=]){2}|([\\>]|[\\≠]|[\\<]){1})"
name: "keyword.operator.comparison.pseudocode"
}
{
match: "(?<![\\/|\\*])([\\+]|[\\-]|[\\*]|[\\/])(?![\\/|\\*])"
name: "keyword.operator.arithmetic.pseudocode"
}
{
match: "(nil|true|false|not|NOT|or|OR|and|AND)(?![a-z|A-Z])"
name: "keyword.operator.logical.pseudocode"
}
{
match: "\\="
name: "keyword.operator.assignment.pseudocode"
}
{
match: "\\b(If|While|Case|Then|Else|Unless|Each|For|End|EndIf|EndWhile|EndFor|if|while|else|then|unless|each|for|endif|endwhile|endfor|end|case|to|step|from)\\b"
name: "keyword.control.pseudocode"
}
{
match: "([\\(](?![\\)])){1}"
name: "meta.begin.brace.round.pseudocode"
}
{
match: "((?<![\\(])[\\)])"
name: "meta.end.brace.round.pseudocode"
}
{
match: "([\\(](?=[\\)])){1}"
name: "punctuation.definition.parameters.begin.bracket.round.pseudocode"
}
{
match: "((?<=[\\(])[\\)])"
name: "punctuation.definition.parameters.end.bracket.round.pseudocode"
}
{
match: "([,]{1})"
name: "punctuation.separator.list.pseudocode"
}
{
match: "([\\[])"
name: "meta.begin.brace.square.pseudocode"
}
{
match: "([\\]])"
name: "meta.end.brace.square.pseudocode"
}
{
match: "\\b(Let|PatternCount|Left|Right|input|output|open|close)\\b"
name: "support.function.pseudocode"
}
{
match: "(^(([a-zA-Z0-9])+(?=[\\(\\)]{2})))"
name: "entity.name.function.pseudocode"
}
{
match: "((([a-zA-Z0-9])+(?=[\\(\\)]{2}[\\r|\\n|\\r\\n])))"
name: "meta.function-call.pseudocode"
}
{
match: "((([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*))(?=\\[(.*?)\\])"
name: "meta.structure.list.pseudocode"
}
{
match: "(?<=\\[)(.*?)(?=\\])"
name: "meta.structure.list.item.pseudocode"
}
{
match: "\\b(start|stop)\\b"
name: "markup.bold.pseudocode"
}
{
match: "\\b(return)\\b"
name: "entity.name.section.pseudocode"
}
{
match: "\\b(Declarations|count|EOF|eof)\\b(?![?!])"
name: "constant.language.pseudocode"
}
{
match: "(?=[:space:]*)\\b(string|num|InputFile|OutputFile)\\b"
name: "storage.type.language.pseudocode"
}
{
match: "(([A-Z0-9]*[a-z][a-z0-9]*[A-Z]|[a-z0-9]*[A-Z][A-Z0-9]*[a-z])[A-Za-z0-9]*)(?![\\(|\\[])"
name: "variable.parameter.pseudocode"
}
{
match: "((?<![a-z])([A-Z]{4,})(?![a-z]))"
name: "variable.other.constant.pseudocode"
}
{
match: "([\\/\\/]{2}.*)"
name: "comment.line.pseudocode"
}
{
begin: "\\/\\*.*"
end: ".*\\*\\/"
name: "comment.block.pseudocode"
}
{
begin: "\""
end: "\""
name: "string.quoted.double.pseudocode"
patterns: [
{
match: "\\\\."
name: "constant.character.escape.pseudocode"
}
]
}
]
scopeName: "source.pseudocode"
imgs/print.png

88.3 KiB

{
"name": "language-pseudocode",
"version": "0.0.1",
"description": "Syntax highlighting for pseudocode",
"engines": {
"atom": "*",
"node": "*"
}
}
'.source.pseudocode':
'editor':
'commentStart': '//'
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment