mirror of https://gitlab.com/cppit/jucipp
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
50 lines
777 B
50 lines
777 B
#!/usr/bin/python |
|
#snippet plugin |
|
import juci_to_python_api |
|
|
|
snippets = {} |
|
snippets["for"] = """\ |
|
for(#int i=0; #i<#v.size(); #i++) { |
|
std::cout << v[i] << std::endl; |
|
} |
|
""" |
|
snippets["if"] = """\ |
|
if(#) { |
|
# |
|
} |
|
""" |
|
snippets["ifelse"] = """\ |
|
if(#) { |
|
# |
|
} else { |
|
# |
|
} |
|
""" |
|
snippets["while"] = """\ |
|
while(#) { |
|
# |
|
} |
|
""" |
|
snippets["main"] = """\ |
|
int main(int argc, char *argv[]) { |
|
//Do something |
|
} |
|
""" |
|
snippets["hello"] = """\ |
|
#include <iostream> |
|
|
|
int main(int argc, char *argv[]) { |
|
std::cout << "Hello, world! << std::endl; |
|
} |
|
""" |
|
def getSnippet(word): |
|
try: |
|
output = snippets[word] |
|
except KeyError: |
|
output = word |
|
return output |
|
|
|
theWord=juci_to_python_api.getWord() |
|
output=getSnippet(theWord) |
|
|
|
juci_to_python_api.replaceWord(output)
|
|
|