├── .gitignore ├── .idea ├── .gitignore ├── .name ├── ComposeCodeEditor.iml ├── artifacts │ ├── common_desktop_1_0.xml │ ├── common_desktop_1_0_2.xml │ ├── common_desktop_1_0_3.xml │ └── desktop_jvm_1_0.xml ├── compiler.xml ├── gradle.xml ├── jarRepositories.xml ├── libraries-with-intellij-classes.xml ├── misc.xml ├── modules │ ├── common │ │ ├── ComposeKMPGP.common.commonTest.iml │ │ └── ComposeKMPGP.common.desktopTest.iml │ └── desktop │ │ ├── ComposeKMPGP.desktop.commonTest.iml │ │ └── ComposeKMPGP.desktop.jvmTest.iml └── vcs.xml ├── LICENSE ├── README.md ├── build.gradle.kts ├── codeeditor ├── build.gradle.kts └── src │ ├── androidMain │ └── AndroidManifest.xml │ └── commonMain │ └── kotlin │ └── com │ └── wakaztahir │ └── codeeditor │ ├── model │ └── CodeLang.kt │ ├── parser │ ├── ParseResult.kt │ └── Parser.kt │ ├── prettify │ ├── PrettifyParser.kt │ ├── lang │ │ ├── Lang.kt │ │ ├── LangAppollo.kt │ │ ├── LangBasic.kt │ │ ├── LangClj.kt │ │ ├── LangCss.kt │ │ ├── LangDart.kt │ │ ├── LangErlang.kt │ │ ├── LangEx.kt │ │ ├── LangGo.kt │ │ ├── LangHs.kt │ │ ├── LangKotlin.kt │ │ ├── LangLasso.kt │ │ ├── LangLisp.kt │ │ ├── LangLlvm.kt │ │ ├── LangLogtalk.kt │ │ ├── LangLua.kt │ │ ├── LangMatlab.kt │ │ ├── LangMd.kt │ │ ├── LangMl.kt │ │ ├── LangMumps.kt │ │ ├── LangN.kt │ │ ├── LangPascal.kt │ │ ├── LangProto.kt │ │ ├── LangR.kt │ │ ├── LangRd.kt │ │ ├── LangScala.kt │ │ ├── LangSql.kt │ │ ├── LangSwift.kt │ │ ├── LangTcl.kt │ │ ├── LangTex.kt │ │ ├── LangVb.kt │ │ ├── LangVhdl.kt │ │ ├── LangWiki.kt │ │ ├── LangXq.kt │ │ └── LangYaml.kt │ └── parser │ │ ├── CombinePrefixPattern.kt │ │ ├── Job.kt │ │ ├── Prettify.kt │ │ └── Util.kt │ ├── theme │ ├── CodeTheme.kt │ ├── EditorThemes.kt │ └── SyntaxColors.kt │ └── utils │ ├── Annotation.kt │ └── utils.kt ├── demo ├── android │ ├── build.gradle.kts │ └── src │ │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── com │ │ └── wakaztahir │ │ └── android │ │ └── MainActivity.kt ├── common │ ├── build.gradle.kts │ └── src │ │ ├── androidMain │ │ └── AndroidManifest.xml │ │ └── commonMain │ │ └── kotlin │ │ └── com │ │ └── wakaztahir │ │ └── common │ │ └── DisplayCodeEditor.kt ├── desktop │ ├── build.gradle.kts │ └── src │ │ └── jvmMain │ │ └── kotlin │ │ └── main.kt └── web │ ├── build.gradle.kts │ ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties │ └── src │ └── jsMain │ ├── kotlin │ ├── BrowserViewportWindow.kt │ └── main.js.kt │ └── resources │ ├── index.html │ └── styles.css ├── docs.sh ├── docs ├── README.md └── api │ ├── codeeditor │ ├── com.wakaztahir.codeeditor.model │ │ ├── -code-lang │ │ │ ├── -appollo │ │ │ │ └── index.html │ │ │ ├── -bash │ │ │ │ └── index.html │ │ │ ├── -basic │ │ │ │ └── index.html │ │ │ ├── -c-p-p │ │ │ │ └── index.html │ │ │ ├── -c-s-s │ │ │ │ └── index.html │ │ │ ├── -c-sharp │ │ │ │ └── index.html │ │ │ ├── -c │ │ │ │ └── index.html │ │ │ ├── -clojure │ │ │ │ └── index.html │ │ │ ├── -coffee-script │ │ │ │ └── index.html │ │ │ ├── -dart │ │ │ │ └── index.html │ │ │ ├── -default │ │ │ │ └── index.html │ │ │ ├── -erlang │ │ │ │ └── index.html │ │ │ ├── -f-sharp │ │ │ │ └── index.html │ │ │ ├── -go │ │ │ │ └── index.html │ │ │ ├── -h-t-m-l │ │ │ │ └── index.html │ │ │ ├── -haskell │ │ │ │ └── index.html │ │ │ ├── -j-s-o-n │ │ │ │ └── index.html │ │ │ ├── -java-script │ │ │ │ └── index.html │ │ │ ├── -java │ │ │ │ └── index.html │ │ │ ├── -lisp │ │ │ │ └── index.html │ │ │ ├── -llvm │ │ │ │ └── index.html │ │ │ ├── -lua │ │ │ │ └── index.html │ │ │ ├── -m-l │ │ │ │ └── index.html │ │ │ ├── -markdown │ │ │ │ └── index.html │ │ │ ├── -matlab │ │ │ │ └── index.html │ │ │ ├── -mumps │ │ │ │ └── index.html │ │ │ ├── -n │ │ │ │ └── index.html │ │ │ ├── -o-c-a-m-l │ │ │ │ └── index.html │ │ │ ├── -objective-c │ │ │ │ └── index.html │ │ │ ├── -pascal │ │ │ │ └── index.html │ │ │ ├── -perl │ │ │ │ └── index.html │ │ │ ├── -proto │ │ │ │ └── index.html │ │ │ ├── -python │ │ │ │ └── index.html │ │ │ ├── -r │ │ │ │ └── index.html │ │ │ ├── -rd │ │ │ │ └── index.html │ │ │ ├── -reg-ex │ │ │ │ └── index.html │ │ │ ├── -ruby │ │ │ │ └── index.html │ │ │ ├── -rust │ │ │ │ └── index.html │ │ │ ├── -s-m-l │ │ │ │ └── index.html │ │ │ ├── -s-q-l │ │ │ │ └── index.html │ │ │ ├── -scala │ │ │ │ └── index.html │ │ │ ├── -tcl │ │ │ │ └── index.html │ │ │ ├── -tex │ │ │ │ └── index.html │ │ │ ├── -v-b │ │ │ │ └── index.html │ │ │ ├── -v-h-d-l │ │ │ │ └── index.html │ │ │ ├── -wiki │ │ │ │ └── index.html │ │ │ ├── -x-m-l │ │ │ │ └── index.html │ │ │ ├── -x-query │ │ │ │ └── index.html │ │ │ ├── -y-a-m-l │ │ │ │ └── index.html │ │ │ ├── index.html │ │ │ └── value.html │ │ └── index.html │ ├── com.wakaztahir.codeeditor.parser │ │ ├── -parse-result │ │ │ ├── -parse-result.html │ │ │ ├── add-style-key.html │ │ │ ├── clear-style-keys.html │ │ │ ├── index.html │ │ │ ├── length.html │ │ │ ├── offset.html │ │ │ ├── remove-style-key.html │ │ │ ├── style-keys-string.html │ │ │ └── to-string.html │ │ ├── -parser │ │ │ ├── index.html │ │ │ └── parse.html │ │ └── index.html │ ├── com.wakaztahir.codeeditor.prettify.lang │ │ ├── -lang-appollo │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-appollo.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-basic │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-basic.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-clj │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-clj.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-css │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-css.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-dart │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-dart.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-erlang │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-erlang.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-go │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-go.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-hs │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-hs.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-lisp │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-lisp.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-llvm │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-llvm.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-lua │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-lua.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-matlab │ │ │ ├── -companion │ │ │ │ ├── -p-r_-c-o-d-e_-o-u-t-p-u-t.html │ │ │ │ ├── -p-r_-c-o-n-s-t-a-n-t.html │ │ │ │ ├── -p-r_-e-r-r-o-r.html │ │ │ │ ├── -p-r_-f-u-n-c-t-i-o-n.html │ │ │ │ ├── -p-r_-f-u-n-c-t-i-o-n_-t-o-o-l-b-o-x.html │ │ │ │ ├── -p-r_-i-d-e-n-t-i-f-i-e-r.html │ │ │ │ ├── -p-r_-l-i-n-e_-c-o-n-t-i-n-u-a-t-i-o-n.html │ │ │ │ ├── -p-r_-s-y-s-c-m-d.html │ │ │ │ ├── -p-r_-t-r-a-n-s-p-o-s-e.html │ │ │ │ ├── -p-r_-w-a-r-n-i-n-g.html │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-matlab.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-md │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-md.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-ml │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-ml.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-mumps │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-mumps.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-n │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-n.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-pascal │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-pascal.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-proto │ │ │ ├── -lang-proto.html │ │ │ └── index.html │ │ ├── -lang-r │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-r.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-rd │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-rd.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-scala │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-scala.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-sql │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-sql.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-tcl │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-tcl.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-tex │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-tex.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-vb │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-vb.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-vhdl │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-vhdl.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-wiki │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-wiki.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-xq │ │ │ ├── -companion │ │ │ │ ├── -p-r_-f-u-n-c-t-i-o-n.html │ │ │ │ ├── -p-r_-v-a-r-i-a-b-l-e.html │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-xq.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang-yaml │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang-yaml.html │ │ │ ├── get-file-extensions.html │ │ │ └── index.html │ │ ├── -lang │ │ │ ├── -companion │ │ │ │ ├── file-extensions.html │ │ │ │ └── index.html │ │ │ ├── -lang.html │ │ │ ├── get-extended-langs.html │ │ │ ├── get-file-extensions.html │ │ │ ├── index.html │ │ │ ├── set-extended-langs.html │ │ │ ├── set-fallthrough-style-patterns.html │ │ │ └── set-shortcut-style-patterns.html │ │ └── index.html │ ├── com.wakaztahir.codeeditor.prettify.parser │ │ ├── -combine-prefix-pattern │ │ │ ├── -combine-prefix-pattern.html │ │ │ ├── combine-prefix-pattern.html │ │ │ └── index.html │ │ ├── -job │ │ │ ├── -job.html │ │ │ ├── base-pos.html │ │ │ ├── get-decorations.html │ │ │ ├── get-source-code.html │ │ │ ├── index.html │ │ │ ├── set-decorations.html │ │ │ └── set-source-code.html │ │ ├── -prettify │ │ │ ├── -companion │ │ │ │ ├── -a-l-l_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -c-o-f-f-e-e_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -c-o-m-m-o-n_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -c-p-p_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -c-s-h-a-r-p_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -c_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -c_-t-y-p-e-s.html │ │ │ │ ├── -f-l-o-w_-c-o-n-t-r-o-l_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -j-a-v-a_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -j-s-c-r-i-p-t_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -p-e-r-l_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -p-r_-a-t-t-r-i-b_-n-a-m-e.html │ │ │ │ ├── -p-r_-a-t-t-r-i-b_-v-a-l-u-e.html │ │ │ │ ├── -p-r_-c-o-m-m-e-n-t.html │ │ │ │ ├── -p-r_-d-e-c-l-a-r-a-t-i-o-n.html │ │ │ │ ├── -p-r_-k-e-y-w-o-r-d.html │ │ │ │ ├── -p-r_-l-i-t-e-r-a-l.html │ │ │ │ ├── -p-r_-n-o-c-o-d-e.html │ │ │ │ ├── -p-r_-p-l-a-i-n.html │ │ │ │ ├── -p-r_-p-u-n-c-t-u-a-t-i-o-n.html │ │ │ │ ├── -p-r_-s-o-u-r-c-e.html │ │ │ │ ├── -p-r_-s-t-r-i-n-g.html │ │ │ │ ├── -p-r_-t-a-g.html │ │ │ │ ├── -p-r_-t-y-p-e.html │ │ │ │ ├── -p-y-t-h-o-n_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -r-u-b-y_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -r-u-s-t_-k-e-y-w-o-r-d-s.html │ │ │ │ ├── -s-h_-k-e-y-w-o-r-d-s.html │ │ │ │ └── index.html │ │ │ ├── -create-simple-lexer │ │ │ │ ├── -create-simple-lexer.html │ │ │ │ ├── decorate.html │ │ │ │ └── index.html │ │ │ ├── -prettify.html │ │ │ ├── get-lang-from-extension.html │ │ │ ├── index.html │ │ │ └── lang-handler-for-extension.html │ │ ├── -style-pattern │ │ │ ├── -style-pattern.html │ │ │ ├── index.html │ │ │ ├── reg-exp.html │ │ │ ├── shortcut-chars.html │ │ │ ├── token-style.html │ │ │ └── unknown-thing.html │ │ ├── -util │ │ │ ├── get-variable-value-as-boolean.html │ │ │ ├── get-variable-value-as-integer.html │ │ │ ├── index.html │ │ │ ├── join.html │ │ │ ├── match.html │ │ │ ├── remove-duplicates.html │ │ │ └── test.html │ │ └── index.html │ ├── com.wakaztahir.codeeditor.prettify │ │ ├── -prettify-parser │ │ │ ├── -prettify-parser.html │ │ │ ├── index.html │ │ │ └── parse.html │ │ └── index.html │ ├── com.wakaztahir.codeeditor.theme │ │ ├── -code-theme-type │ │ │ ├── -default │ │ │ │ ├── index.html │ │ │ │ └── theme.html │ │ │ ├── -monokai │ │ │ │ ├── index.html │ │ │ │ └── theme.html │ │ │ ├── index.html │ │ │ └── theme.html │ │ ├── -code-theme │ │ │ ├── -code-theme.html │ │ │ ├── colors.html │ │ │ ├── index.html │ │ │ └── to-span-style.html │ │ ├── -default-theme │ │ │ ├── -default-theme.html │ │ │ ├── colors.html │ │ │ └── index.html │ │ ├── -monokai-theme │ │ │ ├── -monokai-theme.html │ │ │ ├── colors.html │ │ │ └── index.html │ │ ├── -syntax-colors │ │ │ ├── -syntax-colors.html │ │ │ ├── attr-name.html │ │ │ ├── attr-value.html │ │ │ ├── comment.html │ │ │ ├── declaration.html │ │ │ ├── index.html │ │ │ ├── keyword.html │ │ │ ├── literal.html │ │ │ ├── nocode.html │ │ │ ├── plain.html │ │ │ ├── punctuation.html │ │ │ ├── source.html │ │ │ ├── string.html │ │ │ ├── tag.html │ │ │ └── type.html │ │ └── index.html │ ├── com.wakaztahir.codeeditor.utils │ │ ├── index.html │ │ ├── new.html │ │ ├── parse-code-as-annotated-string.html │ │ └── to-annotated-string.html │ ├── index.html │ └── navigation.html │ ├── images │ ├── anchor-copy-button.svg │ ├── arrow_down.svg │ ├── copy-icon.svg │ ├── copy-successful-icon.svg │ ├── footer-go-to-link.svg │ ├── go-to-top-icon.svg │ ├── logo-icon.svg │ └── theme-toggle.svg │ ├── index.html │ ├── navigation.html │ ├── package-list │ ├── scripts │ ├── clipboard.js │ ├── main.js │ ├── navigation-loader.js │ ├── pages.json │ ├── platform-content-handler.js │ ├── prism.js │ └── sourceset_dependencies.js │ └── styles │ ├── jetbrains-mono.css │ ├── logo-styles.css │ ├── main.css │ ├── prism.css │ └── style.css ├── gradle.properties ├── gradle └── wrapper │ ├── gradle-wrapper.jar │ └── gradle-wrapper.properties ├── gradlew ├── gradlew.bat ├── jitpack.yml ├── kotlin-js-store └── yarn.lock ├── mkdocs.yml └── settings.gradle.kts /.gitignore: -------------------------------------------------------------------------------- 1 | ### Android ### 2 | github.properties 3 | 4 | # Built application files 5 | *.apk 6 | *.ap_ 7 | 8 | # Files for the Dalvik VM 9 | *.dex 10 | 11 | # Java class files 12 | *.class 13 | 14 | # Generated files 15 | bin/ 16 | gen/ 17 | 18 | # Gradle files 19 | .gradle/ 20 | build/ 21 | /*/build/ 22 | 23 | # Ignore Gradle GUI config 24 | gradle-app.setting 25 | 26 | # Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored) 27 | !gradle-wrapper.jar 28 | 29 | # Local configuration file (sdk path, etc) 30 | local.properties 31 | 32 | # Proguard folder generated by Eclipse 33 | proguard/ 34 | 35 | # Log Files 36 | *.log 37 | 38 | ### Android Patch ### 39 | gen-external-apklibs 40 | 41 | 42 | ### Intellij ### 43 | # Covers JetBrains IDEs: IntelliJ, RubyMine, PhpStorm, AppCode, PyCharm 44 | 45 | *.iml 46 | 47 | ## Directory-based project format: 48 | .idea/ 49 | # if you remove the above rule, at least ignore the following: 50 | 51 | # User-specific stuff: 52 | # .idea/workspace.xml 53 | # .idea/tasks.xml 54 | # .idea/dictionaries 55 | 56 | # Sensitive or high-churn files: 57 | # .idea/dataSources.ids 58 | # .idea/dataSources.xml 59 | # .idea/sqlDataSources.xml 60 | # .idea/dynamic.xml 61 | # .idea/uiDesigner.xml 62 | 63 | # Gradle: 64 | # .idea/gradle.xml 65 | # .idea/libraries 66 | 67 | # Mongo Explorer plugin: 68 | # .idea/mongoSettings.xml 69 | 70 | ## File-based project format: 71 | *.ipr 72 | *.iws 73 | 74 | ## Plugin-specific files: 75 | 76 | # IntelliJ 77 | /out/ 78 | 79 | # mpeltonen/sbt-idea plugin 80 | .idea_modules/ 81 | 82 | # JIRA plugin 83 | atlassian-ide-plugin.xml 84 | 85 | # Crashlytics plugin (for Android Studio and IntelliJ) 86 | com_crashlytics_export_strings.xml 87 | crashlytics.properties 88 | crashlytics-build.properties 89 | 90 | .gradle 91 | !gradle/wrapper/gradle-wrapper.jar 92 | !**/src/main/**/build/ 93 | !**/src/test/**/build/ 94 | 95 | ### IntelliJ IDEA ### 96 | .idea/modules.xml 97 | .idea/jarRepositories.xml 98 | .idea/compiler.xml 99 | .idea/libraries/ 100 | out/ 101 | !**/src/main/**/out/ 102 | !**/src/test/**/out/ 103 | 104 | ### Eclipse ### 105 | .apt_generated 106 | .classpath 107 | .factorypath 108 | .project 109 | .settings 110 | .springBeans 111 | .sts4-cache 112 | !**/src/main/**/bin/ 113 | !**/src/test/**/bin/ 114 | 115 | ### NetBeans ### 116 | /nbproject/private/ 117 | /nbbuild/ 118 | /dist/ 119 | /nbdist/ 120 | /.nb-gradle/ 121 | 122 | ### VS Code ### 123 | .vscode/ 124 | 125 | ### Mac OS ### 126 | .DS_Store -------------------------------------------------------------------------------- /.idea/.gitignore: -------------------------------------------------------------------------------- 1 | # Default ignored files 2 | /shelf/ 3 | /workspace.xml 4 | -------------------------------------------------------------------------------- /.idea/.name: -------------------------------------------------------------------------------- 1 | ComposeCodeEditor -------------------------------------------------------------------------------- /.idea/ComposeCodeEditor.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /.idea/artifacts/common_desktop_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/common/build/libs 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/artifacts/common_desktop_1_0_2.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/common/build/libs 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/artifacts/common_desktop_1_0_3.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/common/build/libs 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/artifacts/desktop_jvm_1_0.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | $PROJECT_DIR$/desktop/build/libs 4 | 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /.idea/compiler.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /.idea/gradle.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 22 | 23 | -------------------------------------------------------------------------------- /.idea/jarRepositories.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 9 | 10 | 14 | 15 | 19 | 20 | 24 | 25 | 29 | 30 | 34 | 35 | 39 | 40 | -------------------------------------------------------------------------------- /.idea/libraries-with-intellij-classes.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 64 | 65 | -------------------------------------------------------------------------------- /.idea/misc.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /.idea/modules/common/ComposeKMPGP.common.commonTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules/common/ComposeKMPGP.common.desktopTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules/desktop/ComposeKMPGP.desktop.commonTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/modules/desktop/ComposeKMPGP.desktop.jvmTest.iml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /.idea/vcs.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2024 Kirill Biakov, Waqas Tahir 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /build.gradle.kts: -------------------------------------------------------------------------------- 1 | buildscript { 2 | repositories { 3 | gradlePluginPortal() 4 | google() 5 | mavenCentral() 6 | } 7 | } 8 | 9 | plugins { 10 | kotlin("jvm").apply(false) 11 | kotlin("multiplatform").apply(false) 12 | kotlin("android").apply(false) 13 | id("com.android.application").apply(false) 14 | id("com.android.library").apply(false) 15 | id("org.jetbrains.compose").apply(false) 16 | id("maven-publish") 17 | id("org.jetbrains.dokka") 18 | } 19 | 20 | tasks.withType(){ 21 | outputDirectory.set(rootProject.file("docs/api")) 22 | } 23 | 24 | fun RepositoryHandler.githubPackages() { 25 | maven("https://maven.pkg.github.com/Qawaz/compose-code-editor") { 26 | name = "GithubPackages" 27 | try { 28 | credentials { 29 | username = (System.getenv("GPR_USER")).toString() 30 | password = (System.getenv("GPR_API_KEY")).toString() 31 | } 32 | } catch (ex: Exception) { 33 | ex.printStackTrace() 34 | } 35 | } 36 | } 37 | 38 | subprojects { 39 | apply(plugin = "maven-publish") 40 | publishing { 41 | repositories { 42 | githubPackages() 43 | } 44 | } 45 | } 46 | 47 | allprojects { 48 | repositories { 49 | google() 50 | mavenCentral() 51 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 52 | githubPackages() 53 | } 54 | } -------------------------------------------------------------------------------- /codeeditor/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("maven-publish") 4 | id("org.jetbrains.compose") 5 | id("com.android.library") 6 | id("org.jetbrains.dokka") 7 | } 8 | 9 | group = "com.wakaztahir" 10 | version = findProperty("version") as String 11 | 12 | kotlin { 13 | androidTarget { 14 | publishLibraryVariants("release") 15 | } 16 | jvm("desktop") { 17 | compilations.all { 18 | kotlinOptions.jvmTarget = "17" 19 | } 20 | } 21 | js(IR) { 22 | browser() 23 | binaries.executable() 24 | } 25 | sourceSets { 26 | val commonMain by getting { 27 | dependencies { 28 | api(compose.runtime) 29 | api(compose.foundation) 30 | } 31 | } 32 | val commonTest by getting { 33 | dependencies { 34 | implementation(kotlin("test")) 35 | } 36 | } 37 | val androidMain by getting { 38 | dependencies { 39 | 40 | } 41 | } 42 | // val androidTest by getting { 43 | // dependencies { 44 | // implementation("junit:junit:4.13.2") 45 | // } 46 | // } 47 | val desktopMain by getting { 48 | dependencies { 49 | api(compose.preview) 50 | } 51 | } 52 | val desktopTest by getting 53 | 54 | named("jsMain") { 55 | dependencies { 56 | api(compose.web.core) 57 | } 58 | } 59 | } 60 | } 61 | 62 | android { 63 | compileSdk = 34 64 | sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") 65 | defaultConfig { 66 | minSdk = 21 67 | targetSdk = 33 68 | } 69 | compileOptions { 70 | sourceCompatibility = JavaVersion.VERSION_17 71 | targetCompatibility = JavaVersion.VERSION_17 72 | } 73 | namespace = "com.wakaztahir.codeeditor" 74 | } -------------------------------------------------------------------------------- /codeeditor/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/model/CodeLang.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.model 2 | 3 | import com.wakaztahir.codeeditor.prettify.lang.* 4 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 5 | 6 | enum class CodeLang(val langProvider: Prettify.LangProvider?, val value: List) { 7 | Default(null, listOf("default-code")), 8 | HTML(null, listOf("default-markup")), 9 | C(null, listOf("c")), 10 | CPP(null, listOf("cpp")), 11 | ObjectiveC(null, listOf("cxx")), 12 | CSharp(null, listOf("cs")), 13 | Java(null, listOf("java")), 14 | Bash(null, listOf("bash")), 15 | Python(null, listOf("python")), 16 | Perl(null, listOf("perl")), 17 | Ruby(null, listOf("ruby")), 18 | JavaScript(null, listOf("javascript")), 19 | CoffeeScript(null, listOf("coffee")), 20 | Rust(null, listOf("rust")), 21 | OCAML(null, listOf("ml")), 22 | SML(null, listOf("ml")), 23 | FSharp(null, listOf("fs")), 24 | JSON(null,listOf("json")), 25 | XML(null,listOf("xml")), 26 | Proto(null,listOf("proto")), 27 | RegEx(null,listOf("regex")), 28 | Appollo({ LangAppollo() },LangAppollo.fileExtensions), 29 | Basic({ LangBasic() },LangBasic.fileExtensions), 30 | Clojure({ LangClj() },LangClj.fileExtensions), 31 | CSS({ LangCss() },LangCss.fileExtensions), 32 | Dart({ LangDart() },LangDart.fileExtensions), 33 | Erlang({ LangErlang() },LangErlang.fileExtensions), 34 | Go({ LangGo() },LangGo.fileExtensions), 35 | Haskell({ LangHs() },LangHs.fileExtensions), 36 | Lisp({ LangLisp() },LangLisp.fileExtensions), 37 | Llvm({ LangLlvm() },LangLlvm.fileExtensions), 38 | Lua({ LangLua() },LangLua.fileExtensions), 39 | Matlab({ LangMatlab() },LangMatlab.fileExtensions), 40 | ML({ LangMl() },LangMl.fileExtensions), 41 | Mumps({ LangMumps() },LangMumps.fileExtensions), 42 | N({ LangN() },LangN.fileExtensions), 43 | Pascal({ LangPascal() },LangPascal.fileExtensions), 44 | R({ LangR() },LangR.fileExtensions), 45 | Rd({ LangRd() },LangRd.fileExtensions), 46 | Scala({ LangScala() },LangScala.fileExtensions), 47 | SQL({ LangSql() },LangSql.fileExtensions), 48 | Tex({ LangTex() },LangTex.fileExtensions), 49 | VB({ LangVb() },LangVb.fileExtensions), 50 | VHDL({ LangVhdl() },LangVhdl.fileExtensions), 51 | Tcl({ LangTcl() },LangTcl.fileExtensions), 52 | Wiki({ LangWiki() },LangWiki.fileExtensions), 53 | XQuery({ LangXq() },LangXq.fileExtensions), 54 | YAML({ LangYaml() },LangYaml.fileExtensions), 55 | Markdown({ LangMd() },LangMd.fileExtensions), 56 | Ex({ LangEx() },LangEx.fileExtensions), 57 | Kotlin({ LangKotlin() },LangKotlin.fileExtensions), 58 | Lasso({ LangLasso() },LangLasso.fileExtensions), 59 | Logtalk({ LangLogtalk() },LangLogtalk.fileExtensions), 60 | Swift({ LangSwift() },LangSwift.fileExtensions), 61 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/parser/Parser.kt: -------------------------------------------------------------------------------- 1 | // Copyright (c) 2012 Chan Wai Shing 2 | // 3 | // Permission is hereby granted, free of charge, to any person obtaining 4 | // a copy of this software and associated documentation files (the 5 | // "Software"), to deal in the Software without restriction, including 6 | // without limitation the rights to use, copy, modify, merge, publish, 7 | // distribute, sublicense, and/or sell copies of the Software, and to 8 | // permit persons to whom the Software is furnished to do so, subject to 9 | // the following conditions: 10 | // 11 | // The above copyright notice and this permission notice shall be 12 | // included in all copies or substantial portions of the Software. 13 | // 14 | // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, 15 | // EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 16 | // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND 17 | // NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE 18 | // LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION 19 | // OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION 20 | // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 | package com.wakaztahir.codeeditor.parser 22 | 23 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 24 | 25 | /** 26 | * The parser for syntax highlight. 27 | * 28 | * @author Chan Wai Shing @gmail.com> 29 | */ 30 | interface Parser { 31 | /** 32 | * Parse the `content` and return the parsed result. 33 | * 34 | * @param fileExtension the file extension of the content, null means not 35 | * provided 36 | * @param content the content 37 | * @return the parsed result 38 | */ 39 | fun parse(fileExtension: String, content: String): List 40 | 41 | fun parse(provider: Prettify.LangProvider, content: String): List 42 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/PrettifyParser.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.prettify 2 | 3 | import com.wakaztahir.codeeditor.parser.ParseResult 4 | import com.wakaztahir.codeeditor.parser.Parser 5 | import com.wakaztahir.codeeditor.prettify.parser.Job 6 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 7 | 8 | 9 | /** 10 | * The prettify parser for syntax highlight. 11 | * @author Chan Wai Shing @gmail.com> 12 | */ 13 | class PrettifyParser : Parser { 14 | 15 | private val prettify: Prettify = Prettify() 16 | 17 | override fun parse(fileExtension: String, content: String): List = 18 | parse(prettify.getLexerForExtension(fileExtension), content) 19 | 20 | override fun parse(provider: Prettify.LangProvider, content: String): List = 21 | parse(prettify.getLexerForLanguageProvider(provider), content) 22 | 23 | private fun parse(lexer: Prettify.CreateSimpleLexer, content: String): List { 24 | val job = Job(0, content) 25 | lexer.decorate(job) 26 | val decorations = job.decorations 27 | val returnList = ArrayList() 28 | 29 | // apply style according to the style list 30 | var i = 0 31 | val iEnd = decorations.size 32 | while (i < iEnd) { 33 | val endPos = if (i + 2 < iEnd) decorations[i + 2] as Int else content.length 34 | val startPos = decorations[i] as Int 35 | returnList.add( 36 | ParseResult(startPos, endPos - startPos, listOf((decorations[i + 1] as String))) 37 | ) 38 | i += 2 39 | } 40 | return returnList 41 | } 42 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/Lang.kt: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2011 Chan Wai Shing 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package com.wakaztahir.codeeditor.prettify.lang 15 | 16 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 17 | 18 | /** 19 | * Lang class for Java Prettify. 20 | * Note that the method [.getFileExtensions] should be overridden. 21 | * 22 | * @author Chan Wai Shing @gmail.com> 23 | */ 24 | abstract class Lang { 25 | /** 26 | * Similar to those in JavaScript prettify.js. 27 | */ 28 | abstract val shortcutStylePatterns: List 29 | 30 | /** 31 | * Similar to those in JavaScript prettify.js. 32 | */ 33 | abstract val fallthroughStylePatterns: List 34 | 35 | abstract fun getFileExtensions(): List 36 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangBasic.kt: -------------------------------------------------------------------------------- 1 | // Contributed by peter dot kofler at code minus cop dot org 2 | package com.wakaztahir.codeeditor.prettify.lang 3 | 4 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 5 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 6 | import com.wakaztahir.codeeditor.utils.new 7 | 8 | /** 9 | * This is similar to the lang-basic.js in JavaScript Prettify. 10 | * 11 | * 12 | * To use, include prettify.js and this file in your HTML page. 13 | * Then put your code in an HTML tag like 14 | *
(my BASIC code)
15 | * 16 | * @author peter dot kofler at code minus cop dot org 17 | */ 18 | class LangBasic : Lang() { 19 | 20 | companion object { 21 | val fileExtensions = listOf("basic", "cbm") 22 | } 23 | 24 | override fun getFileExtensions(): List = fileExtensions 25 | 26 | override val fallthroughStylePatterns = ArrayList() 27 | override val shortcutStylePatterns = ArrayList() 28 | 29 | init { 30 | // "single-line-string" 31 | shortcutStylePatterns.new( 32 | Prettify.PR_STRING, 33 | Regex("^(?:\"(?:[^\\\\\"\\r\\n]|\\\\.)*(?:\"|$))"), 34 | null 35 | ) 36 | // Whitespace 37 | shortcutStylePatterns.new( 38 | Prettify.PR_PLAIN, Regex("^\\s+"), null 39 | ) 40 | 41 | // A line comment that starts with REM 42 | fallthroughStylePatterns.new( 43 | Prettify.PR_COMMENT, Regex("^REM[^\\r\\n]*"), null 44 | ) 45 | 46 | fallthroughStylePatterns.new( 47 | Prettify.PR_KEYWORD, 48 | Regex("^\\b(?:AND|CLOSE|CLR|CMD|CONT|DATA|DEF ?FN|DIM|END|FOR|GET|GOSUB|GOTO|IF|INPUT|LET|LIST|LOAD|NEW|NEXT|NOT|ON|OPEN|OR|POKE|PRINT|READ|RESTORE|RETURN|RUN|SAVE|STEP|STOP|SYS|THEN|TO|VERIFY|WAIT)\\b"), 49 | null 50 | ) 51 | fallthroughStylePatterns.new( 52 | Prettify.PR_PLAIN, Regex("^[A-Z][A-Z0-9]?(?:\\$|%)?", RegexOption.IGNORE_CASE), null 53 | ) 54 | // Literals .0, 0, 0.0 0E13 55 | fallthroughStylePatterns.new( 56 | Prettify.PR_LITERAL, 57 | Regex("^(?:\\d+(?:\\.\\d*)?|\\.\\d+)(?:e[+\\-]?\\d+)?", RegexOption.IGNORE_CASE), 58 | null 59 | ) 60 | fallthroughStylePatterns.new( 61 | Prettify.PR_PUNCTUATION, Regex("^.[^\\s\\w\\.$%\"]*"), null 62 | ) 63 | } 64 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangKotlin.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.prettify.lang 2 | 3 | 4 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 5 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 6 | import com.wakaztahir.codeeditor.utils.new 7 | 8 | class LangKotlin : Lang() { 9 | 10 | companion object { 11 | val fileExtensions = listOf("kt", "kotlin") 12 | } 13 | 14 | override fun getFileExtensions(): List = fileExtensions 15 | 16 | override val fallthroughStylePatterns = ArrayList() 17 | override val shortcutStylePatterns = ArrayList() 18 | 19 | init { 20 | shortcutStylePatterns.new( 21 | Prettify.PR_PLAIN, 22 | Regex("^[\\t\\n\\r \\xA0]+"), 23 | null 24 | ) 25 | shortcutStylePatterns.new( 26 | Prettify.PR_PUNCTUATION, 27 | Regex("^[.!%&()*+,\\-;<=>?\\[\\\\\\]^{|}:]+"), 28 | null 29 | ) 30 | fallthroughStylePatterns.new( 31 | Prettify.PR_KEYWORD, 32 | Regex("^\\b(package|public|protected|external|internal|private|open|abstract|constructor|final|override|import|for|while|as|typealias|get|set|((data|enum|annotation|sealed) )?class|this|super|val|var|fun|is|in|throw|return|break|continue|(companion )?object|if|try|else|do|when|init|interface|typeof)\\b") 33 | ) 34 | fallthroughStylePatterns.new( 35 | Prettify.PR_LITERAL, 36 | Regex("^(?:true|false|null)\\b") 37 | ) 38 | fallthroughStylePatterns.new( 39 | Prettify.PR_LITERAL, 40 | Regex("^(0[xX][0-9a-fA-F_]+L?|0[bB][0-1]+L?|[0-9_.]+([eE]-?[0-9]+)?[fFL]?)") 41 | ) 42 | fallthroughStylePatterns.new( 43 | Prettify.PR_TYPE, 44 | Regex("^(\\b[A-Z]+[a-z][a-zA-Z0-9_$@]*|`.*`)"), 45 | null 46 | ) 47 | fallthroughStylePatterns.new(Prettify.PR_COMMENT, Regex("^\\/\\/.*")) 48 | fallthroughStylePatterns.new( 49 | Prettify.PR_COMMENT, 50 | Regex("^\\/\\*[\\s\\S]*?(?:\\*\\/|$)") 51 | ) 52 | fallthroughStylePatterns.new(Prettify.PR_STRING, Regex("'.'")) 53 | fallthroughStylePatterns.new( 54 | Prettify.PR_STRING, 55 | Regex("^\"([^\"\\\\]|\\\\[\\s\\S])*\"") 56 | ) 57 | fallthroughStylePatterns.new( 58 | Prettify.PR_STRING, 59 | Regex("^\"{3}[\\s\\S]*?[^\\\\]\"{3}") 60 | ) 61 | fallthroughStylePatterns.new( 62 | Prettify.PR_LITERAL, 63 | Regex("^@([a-zA-Z0-9_$@]*|`.*`)") 64 | ) 65 | fallthroughStylePatterns.new( 66 | Prettify.PR_LITERAL, 67 | Regex("^[a-zA-Z0-9_]+@") 68 | ) 69 | 70 | 71 | } 72 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangLogtalk.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.prettify.lang 2 | 3 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 4 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 5 | import com.wakaztahir.codeeditor.utils.new 6 | 7 | class LangLogtalk : Lang() { 8 | 9 | companion object { 10 | val fileExtensions = listOf("logtalk", "lgt") 11 | } 12 | 13 | override fun getFileExtensions(): List = fileExtensions 14 | 15 | override val fallthroughStylePatterns = ArrayList() 16 | override val shortcutStylePatterns = ArrayList() 17 | 18 | init { 19 | shortcutStylePatterns.new( 20 | Prettify.PR_STRING, 21 | Regex("^\\\"(?:[^\\\"\\\\\\n\\x0C\\r]|\\\\[\\s\\S])*(?:\\\"|$)"), 22 | null 23 | ) 24 | shortcutStylePatterns.new( 25 | Prettify.PR_LITERAL, 26 | Regex("^[a-z][a-zA-Z0-9_]*") 27 | ) 28 | shortcutStylePatterns.new( 29 | Prettify.PR_LITERAL, 30 | Regex("^\\'(?:[^\\'\\\\\\n\\x0C\\r]|\\\\[^&])+\\'?"), 31 | null 32 | ) 33 | shortcutStylePatterns.new( 34 | Prettify.PR_LITERAL, 35 | Regex( 36 | "^(?:0'.|0b[0-1]+|0o[0-7]+|0x[\\da-f]+|\\d+(?:\\.\\d+)?(?:e[+\\-]?\\d+)?)", 37 | RegexOption.IGNORE_CASE 38 | ), 39 | null 40 | ) 41 | fallthroughStylePatterns.new( 42 | Prettify.PR_COMMENT, 43 | Regex("^%[^\\r\\n]*"), 44 | null 45 | ) 46 | fallthroughStylePatterns.new( 47 | Prettify.PR_COMMENT, 48 | Regex("^\\/\\*[\\s\\S]*?\\*\\/") 49 | ) 50 | fallthroughStylePatterns.new( 51 | Prettify.PR_KEYWORD, 52 | Regex("^\\s*:-\\s(c(a(lls|tegory)|oinductive)|p(ublic|r(ot(ocol|ected)|ivate))|e(l(if|se)|n(coding|sure_loaded)|xport)|i(f|n(clude|itialization|fo))|alias|d(ynamic|iscontiguous)|m(eta_(non_terminal|predicate)|od(e|ule)|ultifile)|reexport|s(et_(logtalk|prolog)_flag|ynchronized)|o(bject|p)|use(s|_module))") 53 | ) 54 | fallthroughStylePatterns.new( 55 | Prettify.PR_KEYWORD, 56 | Regex("^\\s*:-\\s(e(lse|nd(if|_(category|object|protocol)))|built_in|dynamic|synchronized|threaded)") 57 | ) 58 | fallthroughStylePatterns.new( 59 | Prettify.PR_TYPE, 60 | Regex("^[A-Z_][a-zA-Z0-9_]*") 61 | ) 62 | fallthroughStylePatterns.new( 63 | Prettify.PR_PUNCTUATION, 64 | Regex("^[.,;{}:^<>=\\\\/+*?#!-]") 65 | ) 66 | 67 | 68 | } 69 | } 70 | -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangMd.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.prettify.lang 2 | 3 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 4 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 5 | import com.wakaztahir.codeeditor.utils.new 6 | 7 | /** 8 | * Registers a language handler for markdown. 9 | * 10 | * @author Kirill Biakov (kbiakov@gmail.com) 11 | */ 12 | class LangMd : Lang() { 13 | companion object { 14 | val fileExtensions: List 15 | get() = listOf("md", "markdown") 16 | } 17 | 18 | override val fallthroughStylePatterns = ArrayList() 19 | override val shortcutStylePatterns = ArrayList() 20 | 21 | init { 22 | fallthroughStylePatterns.new( 23 | Prettify.PR_DECLARATION, 24 | Regex("^#.*?[\\n\\r]") 25 | ) 26 | fallthroughStylePatterns.new( 27 | Prettify.PR_STRING, 28 | Regex("^```[\\s\\S]*?(?:```|$)") 29 | ) 30 | 31 | 32 | } 33 | 34 | override fun getFileExtensions(): List { 35 | return fileExtensions 36 | } 37 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangProto.kt: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package com.wakaztahir.codeeditor.prettify.lang 15 | 16 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 17 | 18 | /** 19 | * It is included directly in the [Prettify]. 20 | */ 21 | class LangProto -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangRd.kt: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2012 Jeffrey Arnold 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package com.wakaztahir.codeeditor.prettify.lang 15 | 16 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 17 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 18 | import com.wakaztahir.codeeditor.utils.new 19 | 20 | /** 21 | * This is similar to the lang-rd.js in JavaScript Prettify. 22 | * 23 | * 24 | * Support for R documentation (Rd) files 25 | * 26 | * 27 | * Minimal highlighting or Rd files, basically just highlighting 28 | * macros. It does not try to identify verbatim or R-like regions of 29 | * macros as that is too complicated for a lexer. Descriptions of the 30 | * Rd format can be found 31 | * http://cran.r-project.org/doc/manuals/R-exts.html and 32 | * http://developer.r-project.org/parseRd.pdf. 33 | * 34 | * @author Jeffrey Arnold 35 | */ 36 | class LangRd : Lang() { 37 | companion object { 38 | val fileExtensions: List 39 | get() = listOf("Rd", "rd") 40 | } 41 | 42 | override val fallthroughStylePatterns = ArrayList() 43 | override val shortcutStylePatterns = ArrayList() 44 | 45 | init { 46 | 47 | // whitespace 48 | shortcutStylePatterns.new( 49 | Prettify.PR_PLAIN, Regex("^[\\t\\n\\r \\xA0]+"), null 50 | ) 51 | // all comments begin with '%' 52 | shortcutStylePatterns.new( 53 | Prettify.PR_COMMENT, 54 | Regex("^%[^\\r\\n]*"), 55 | null 56 | ) 57 | 58 | // special macros with no args 59 | fallthroughStylePatterns.new( 60 | Prettify.PR_LITERAL, 61 | Regex("^\\\\(?:cr|l?dots|R|tab)\\b") 62 | ) 63 | // macros 64 | fallthroughStylePatterns.new( 65 | Prettify.PR_KEYWORD, 66 | Regex("^\\\\[a-zA-Z@]+") 67 | ) 68 | // highlighted as macros, since technically they are 69 | fallthroughStylePatterns.new( 70 | Prettify.PR_KEYWORD, 71 | Regex("^#(?:ifn?def|endif)") 72 | ) 73 | // catch escaped brackets 74 | fallthroughStylePatterns.new(Prettify.PR_PLAIN, Regex("^\\\\[{}]")) 75 | // punctuation 76 | fallthroughStylePatterns.new( 77 | Prettify.PR_PUNCTUATION, 78 | Regex("^[{}()\\[\\]]+") 79 | ) 80 | 81 | 82 | } 83 | 84 | override fun getFileExtensions(): List { 85 | return fileExtensions 86 | } 87 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangSwift.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.prettify.lang 2 | 3 | 4 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 5 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 6 | import com.wakaztahir.codeeditor.utils.new 7 | 8 | class LangSwift : Lang() { 9 | 10 | 11 | override val fallthroughStylePatterns = ArrayList() 12 | override val shortcutStylePatterns = ArrayList() 13 | 14 | companion object { 15 | val fileExtensions = listOf("swift") 16 | } 17 | 18 | override fun getFileExtensions(): List = fileExtensions 19 | 20 | init { 21 | shortcutStylePatterns.new( 22 | Prettify.PR_PLAIN, 23 | Regex("^[ \\n\\r\\t\\v\\u000c\\\u0000]+"), 24 | null 25 | ) 26 | shortcutStylePatterns.new( 27 | Prettify.PR_STRING, 28 | Regex("^\"(?:[^\"\\\\]|(?:\\\\.)|(?:\\\\\\((?:[^\"\\\\)]|\\\\.)*\\)))*\""), 29 | null 30 | ) 31 | fallthroughStylePatterns.new( 32 | Prettify.PR_LITERAL, 33 | Regex("^(?:(?:0x[\\da-fA-F][\\da-fA-F_]*\\.[\\da-fA-F][\\da-fA-F_]*[pP]?)|(?:\\d[\\d_]*\\.\\d[\\d_]*[eE]?))[+-]?\\d[\\d_]*"), 34 | null 35 | ) 36 | fallthroughStylePatterns.new( 37 | Prettify.PR_LITERAL, 38 | Regex("^-?(?:(?:0(?:(?:b[01][01_]*)|(?:o[0-7][0-7_]*)|(?:x[\\da-fA-F][\\da-fA-F_]*)))|(?:\\d[\\d_]*))"), 39 | null 40 | 41 | ) 42 | fallthroughStylePatterns.new( 43 | Prettify.PR_LITERAL, 44 | Regex("^(?:_|Any|true|false|nil)\\b"), 45 | null 46 | ) 47 | fallthroughStylePatterns.new( 48 | Prettify.PR_KEYWORD, 49 | Regex("^\\b(?:__COLUMN__|__FILE__|__FUNCTION__|__LINE__|#available|#colorLiteral|#column|#else|#elseif|#endif|#file|#fileLiteral|#function|#if|#imageLiteral|#line|#selector|#sourceLocation|arch|arm|arm64|associatedtype|associativity|as|break|case|catch|class|continue|convenience|default|defer|deinit|didSet|do|dynamic|dynamicType|else|enum|extension|fallthrough|fileprivate|final|for|func|get|guard|import|indirect|infix|init|inout|internal|i386|if|in|iOS|iOSApplicationExtension|is|lazy|left|let|mutating|none|nonmutating|open|operator|optional|OSX|OSXApplicationExtension|override|postfix|precedence|prefix|private|protocol|Protocol|public|repeat|required|rethrows|return|right|safe|Self|self|set|static|struct|subscript|super|switch|throw|throws|try|Type|typealias|unowned|unsafe|var|weak|watchOS|where|while|willSet|x86_64)\\b"), 50 | null 51 | ) 52 | fallthroughStylePatterns.new( 53 | Prettify.PR_COMMENT, 54 | Regex("^\\/\\/.*?[\\n\\r]"), 55 | null 56 | ) 57 | fallthroughStylePatterns.new( 58 | Prettify.PR_COMMENT, 59 | Regex("^\\/\\*[\\s\\S]*?(?:\\*\\/|$)"), 60 | null 61 | ) 62 | fallthroughStylePatterns.new( 63 | Prettify.PR_PUNCTUATION, 64 | Regex("^<<=|<=|<<|>>=|>=|>>|===|==|\\.\\.\\.|&&=|\\.\\.<|!==|!=|&=|~=|~|\\(|\\)|\\[|\\]|\\{|}|@|#|;|\\.|,|:|\\|\\|=|\\?\\?|\\|\\||&&|&\\*|&\\+|&-|&=|\\+=|-=|\\/=|\\*=|\\^=|%=|\\|=|->|`|==|\\+\\+|--|\\/|\\+|!|\\*|%|<|>|&|\\||\\^|\\?|=|-|_"), 65 | null 66 | ) 67 | fallthroughStylePatterns.new( 68 | Prettify.PR_TYPE, 69 | Regex("^\\b(?:[@_]?[A-Z]+[a-z][A-Za-z_$@0-9]*|\\w+_t\\b)"), 70 | null 71 | ) 72 | 73 | 74 | } 75 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangTex.kt: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2011 Martin S. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package com.wakaztahir.codeeditor.prettify.lang 15 | 16 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 17 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 18 | import com.wakaztahir.codeeditor.utils.new 19 | 20 | /** 21 | * This is similar to the lang-tex.js in JavaScript Prettify. 22 | * 23 | * All comments are adapted from the JavaScript Prettify. 24 | * 25 | * 26 | * 27 | * Support for tex highlighting as discussed on 28 | * [meta.tex.stackexchange.com](http://meta.tex.stackexchange.com/questions/872/text-immediate-following-double-backslashes-is-highlighted-as-macro-inside-a-code/876#876). 29 | * 30 | * @author Martin S. 31 | */ 32 | class LangTex : Lang() { 33 | companion object { 34 | val fileExtensions: List 35 | get() = listOf("latex", "tex") 36 | } 37 | 38 | override val fallthroughStylePatterns = ArrayList() 39 | override val shortcutStylePatterns = ArrayList() 40 | 41 | init { 42 | 43 | 44 | 45 | // whitespace 46 | shortcutStylePatterns.new( 47 | Prettify.PR_PLAIN, Regex("^[\\t\\n\\r \\xA0]+"), null 48 | ) 49 | // all comments begin with '%' 50 | shortcutStylePatterns.new( 51 | Prettify.PR_COMMENT, 52 | Regex("^%[^\\r\\n]*"), 53 | null 54 | ) 55 | //[PR['PR_DECLARATION'], /^\\([egx]?def|(new|renew|provide)(command|environment))\b/], 56 | // any command starting with a \ and contains 57 | // either only letters (a-z,A-Z), '@' (internal macros) 58 | fallthroughStylePatterns.new( 59 | Prettify.PR_KEYWORD, 60 | Regex("^\\\\[a-zA-Z@]+") 61 | ) 62 | // or contains only one character 63 | fallthroughStylePatterns.new(Prettify.PR_KEYWORD, Regex("^\\\\.")) 64 | // Highlight dollar for math mode and ampersam for tabular 65 | fallthroughStylePatterns.new(Prettify.PR_TYPE, Regex("^[$&]")) 66 | // numeric measurement values with attached units 67 | fallthroughStylePatterns.new( 68 | Prettify.PR_LITERAL, 69 | Regex( 70 | "[+-]?(?:\\.\\d+|\\d+(?:\\.\\d*)?)(cm|em|ex|in|pc|pt|bp|mm)", 71 | RegexOption.IGNORE_CASE 72 | ) 73 | ) 74 | // punctuation usually occurring within commands 75 | fallthroughStylePatterns.new( 76 | Prettify.PR_PUNCTUATION, 77 | Regex("^[{}()\\[\\]=]+") 78 | ) 79 | 80 | 81 | } 82 | 83 | override fun getFileExtensions(): List { 84 | return fileExtensions 85 | } 86 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/lang/LangYaml.kt: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2010 ribrdb @ code.google.com 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package com.wakaztahir.codeeditor.prettify.lang 15 | 16 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 17 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 18 | import com.wakaztahir.codeeditor.utils.new 19 | 20 | /** 21 | * This is similar to the lang-yaml.js in JavaScript Prettify. 22 | * 23 | * All comments are adapted from the JavaScript Prettify. 24 | * 25 | * 26 | * 27 | * Registers a language handler for YAML. 28 | * 29 | * @author ribrdb 30 | */ 31 | class LangYaml : Lang() { 32 | companion object { 33 | val fileExtensions: List 34 | get() = listOf("yaml", "yml") 35 | } 36 | 37 | override val fallthroughStylePatterns = ArrayList() 38 | override val shortcutStylePatterns = ArrayList() 39 | 40 | init { 41 | shortcutStylePatterns.new( 42 | Prettify.PR_PUNCTUATION, 43 | Regex("^[:|>?]+"), 44 | null 45 | ) 46 | shortcutStylePatterns.new( 47 | Prettify.PR_DECLARATION, 48 | Regex("^%(?:YAML|TAG)[^#\\r\\n]+"), 49 | null 50 | ) 51 | shortcutStylePatterns.new( 52 | Prettify.PR_TYPE, 53 | Regex("^[&]\\S+"), 54 | null 55 | ) 56 | shortcutStylePatterns.new( 57 | Prettify.PR_TYPE, 58 | Regex("^!\\S*"), 59 | null 60 | ) 61 | shortcutStylePatterns.new( 62 | Prettify.PR_STRING, 63 | Regex("^\"(?:[^\\\\\"]|\\\\.)*(?:\"|$)"), 64 | null 65 | ) 66 | shortcutStylePatterns.new( 67 | Prettify.PR_STRING, 68 | Regex("^'(?:[^']|'')*(?:'|$)"), 69 | null 70 | ) 71 | shortcutStylePatterns.new( 72 | Prettify.PR_COMMENT, 73 | Regex("^#[^\\r\\n]*"), 74 | null 75 | ) 76 | shortcutStylePatterns.new( 77 | Prettify.PR_PLAIN, 78 | Regex("^\\s+"), 79 | null 80 | ) 81 | fallthroughStylePatterns.new( 82 | Prettify.PR_DECLARATION, 83 | Regex("^(?:---|\\.\\.\\.)(?:[\\r\\n]|$)") 84 | ) 85 | fallthroughStylePatterns.new(Prettify.PR_PUNCTUATION, Regex("^-")) 86 | fallthroughStylePatterns.new( 87 | Prettify.PR_KEYWORD, 88 | Regex("^\\w+:[ \\r\\n]") 89 | ) 90 | fallthroughStylePatterns.new(Prettify.PR_PLAIN, Regex("^\\w+")) 91 | 92 | 93 | } 94 | 95 | override fun getFileExtensions(): List { 96 | return fileExtensions 97 | } 98 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/prettify/parser/Job.kt: -------------------------------------------------------------------------------- 1 | // Copyright (C) 2006 Google Inc. 2 | // 3 | // Licensed under the Apache License, Version 2.0 (the "License"); 4 | // you may not use this file except in compliance with the License. 5 | // You may obtain a copy of the License at 6 | // 7 | // http://www.apache.org/licenses/LICENSE-2.0 8 | // 9 | // Unless required by applicable law or agreed to in writing, software 10 | // distributed under the License is distributed on an "AS IS" BASIS, 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | // See the License for the specific language governing permissions and 13 | // limitations under the License. 14 | package com.wakaztahir.codeeditor.prettify.parser 15 | 16 | /** 17 | * This is the job object that similar to those in JavaScript Prettify. 18 | * 19 | * @author Chan Wai Shing @gmail.com> 20 | */ 21 | class Job constructor(basePos: Int = 0, sourceCode: String? = "") { 22 | /** 23 | * Set the starting point of the source code. 24 | * 25 | * @return the position 26 | */ 27 | /** 28 | * Set the starting point of the source code. 29 | * 30 | * @param basePos the position 31 | */ 32 | /** 33 | * The starting point of the source code. 34 | */ 35 | var basePos: Int 36 | 37 | /** 38 | * The source code. 39 | */ 40 | private var sourceCode: String 41 | 42 | /** 43 | * The parsed results. nth items are starting position position, 44 | * n+1th items are the three-letter style keyword, where n start 45 | * from 0. 46 | */ 47 | internal var decorations: List 48 | 49 | /** 50 | * Get the source code. 51 | * 52 | * @return the source code 53 | */ 54 | fun getSourceCode(): String { 55 | return sourceCode 56 | } 57 | 58 | /** 59 | * Set the source code. 60 | * 61 | * @param sourceCode the source code 62 | */ 63 | fun setSourceCode(sourceCode: String?) { 64 | if (sourceCode == null) { 65 | throw NullPointerException("argument 'sourceCode' cannot be null") 66 | } 67 | this.sourceCode = sourceCode 68 | } 69 | 70 | /** 71 | * Get the parsed results. see [.decorations]. 72 | * 73 | * @return the parsed results 74 | */ 75 | fun getDecorations(): List { 76 | return ArrayList(decorations) 77 | } 78 | 79 | /** 80 | * Set the parsed results. see [.decorations]. 81 | * 82 | * @param decorations the parsed results 83 | */ 84 | fun setDecorations(decorations: List?) { 85 | if (decorations == null) { 86 | this.decorations = ArrayList() 87 | return 88 | } 89 | this.decorations = ArrayList(decorations) 90 | } 91 | /** 92 | * Constructor. 93 | * 94 | * @param basePos the starting point of the source code 95 | * @param sourceCode the source code 96 | */ 97 | /** 98 | * Constructor. 99 | */ 100 | init { 101 | if (sourceCode == null) { 102 | throw NullPointerException("argument 'sourceCode' cannot be null") 103 | } 104 | this.basePos = basePos 105 | this.sourceCode = sourceCode 106 | decorations = ArrayList() 107 | } 108 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/theme/CodeTheme.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.theme 2 | 3 | import androidx.compose.ui.text.SpanStyle 4 | import com.wakaztahir.codeeditor.parser.ParseResult 5 | import com.wakaztahir.codeeditor.prettify.parser.Prettify 6 | 7 | abstract class CodeTheme(private val colors: SyntaxColors) { 8 | 9 | private val colorMap = hashMapOf( 10 | Prettify.PR_TYPE to colors.type, 11 | Prettify.PR_KEYWORD to colors.keyword, 12 | Prettify.PR_LITERAL to colors.literal, 13 | Prettify.PR_COMMENT to colors.comment, 14 | Prettify.PR_STRING to colors.string, 15 | Prettify.PR_PUNCTUATION to colors.punctuation, 16 | Prettify.PR_PLAIN to colors.plain, 17 | Prettify.PR_TAG to colors.tag, 18 | Prettify.PR_DECLARATION to colors.declaration, 19 | Prettify.PR_SOURCE to colors.source, 20 | Prettify.PR_ATTRIB_NAME to colors.attrName, 21 | Prettify.PR_ATTRIB_VALUE to colors.attrValue, 22 | Prettify.PR_NOCODE to colors.nocode 23 | ) 24 | 25 | open infix fun toSpanStyle(result: ParseResult): SpanStyle { 26 | return SpanStyle(color = colorMap[result.styleKeysString] ?: kotlin.run { 27 | Throwable("Missing color value for style key : ${result.styleKeysString}").printStackTrace() 28 | colors.nocode 29 | }) 30 | } 31 | } 32 | 33 | enum class CodeThemeType { 34 | Default { 35 | override fun getTheme(): CodeTheme = DefaultTheme() 36 | }, 37 | Monokai { 38 | override fun getTheme(): CodeTheme = MonokaiTheme() 39 | }; 40 | 41 | internal abstract fun getTheme() : CodeTheme 42 | private var _theme : CodeTheme? = null 43 | val theme : CodeTheme 44 | get() { 45 | if(_theme == null) _theme = getTheme() 46 | return _theme!! 47 | } 48 | } -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/theme/EditorThemes.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | class DefaultTheme : CodeTheme( 6 | colors = SyntaxColors( 7 | type = Color(0xFF859900), 8 | keyword = Color(0xFF268BD2), 9 | literal = Color(0xFF269186), 10 | comment = Color(0xFF93A1A1), 11 | string = Color(0xFF269186), 12 | punctuation = Color(0xFF586E75), 13 | plain = Color(0xFF586E75), 14 | tag = Color(0xFF859900), 15 | declaration = Color(0xFF268BD2), 16 | source = Color(0xFF586E75), 17 | attrName = Color(0xFF268BD2), 18 | attrValue = Color(0xFF269186), 19 | nocode = Color(0xFF586E75), 20 | ) 21 | ) 22 | 23 | class MonokaiTheme : CodeTheme( 24 | colors = SyntaxColors( 25 | type = Color(0xFFA7E22E), 26 | keyword = Color(0xFFFA2772), 27 | literal = Color(0xFF66D9EE), 28 | comment = Color(0xFF76715E), 29 | string = Color(0xFFE6DB74), 30 | punctuation = Color(0xFFC1C1C1), 31 | plain = Color(0xFFF8F8F0), 32 | tag = Color(0xFFF92672), 33 | declaration = Color(0xFFFA2772), 34 | source = Color(0xFFF8F8F0), 35 | attrName = Color(0xFFA6E22E), 36 | attrValue = Color(0xFFE6DB74), 37 | nocode = Color(0xFFF8F8F0), 38 | ) 39 | ) -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/theme/SyntaxColors.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.theme 2 | 3 | import androidx.compose.ui.graphics.Color 4 | 5 | class SyntaxColors( 6 | val type: Color, 7 | val keyword: Color, 8 | val literal: Color, 9 | val comment: Color, 10 | val string: Color, 11 | val punctuation: Color, 12 | val plain: Color, 13 | val tag: Color, 14 | val declaration: Color, 15 | val source: Color, 16 | val attrName: Color, 17 | val attrValue: Color, 18 | val nocode: Color, 19 | ) 20 | -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/utils/Annotation.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.utils 2 | 3 | import androidx.compose.ui.text.AnnotatedString 4 | import com.wakaztahir.codeeditor.model.CodeLang 5 | import com.wakaztahir.codeeditor.parser.ParseResult 6 | import com.wakaztahir.codeeditor.prettify.PrettifyParser 7 | import com.wakaztahir.codeeditor.theme.CodeTheme 8 | 9 | fun List.toAnnotatedString(theme: CodeTheme, source: String): AnnotatedString = AnnotatedString( 10 | text = source, 11 | spanStyles = map { 12 | AnnotatedString.Range(theme toSpanStyle it, it.offset, it.offset + it.length) 13 | } 14 | ) 15 | 16 | fun parseCodeAsAnnotatedString( 17 | parser: PrettifyParser, 18 | theme: CodeTheme, 19 | lang: String, 20 | code: String 21 | ): AnnotatedString = parser.parse(lang, code).toAnnotatedString(theme, code) 22 | 23 | fun parseCodeAsAnnotatedString( 24 | parser: PrettifyParser, 25 | theme: CodeTheme, 26 | lang: CodeLang, 27 | code: String 28 | ): AnnotatedString = lang.langProvider?.let { 29 | parser.parse(it, code).toAnnotatedString(theme, code) 30 | } ?: parseCodeAsAnnotatedString( 31 | parser = parser, 32 | theme = theme, 33 | lang = lang.value.first(), 34 | code = code, 35 | ) -------------------------------------------------------------------------------- /codeeditor/src/commonMain/kotlin/com/wakaztahir/codeeditor/utils/utils.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.codeeditor.utils 2 | 3 | import com.wakaztahir.codeeditor.prettify.parser.StylePattern 4 | 5 | internal fun MutableList.new( 6 | tokenStyle: String, 7 | regExp: Regex, 8 | shortcutChars: String? = null, 9 | ) = add( 10 | StylePattern( 11 | tokenStyle = tokenStyle, 12 | regExp = regExp, 13 | shortcutChars = shortcutChars 14 | ) 15 | ) 16 | -------------------------------------------------------------------------------- /demo/android/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | id("org.jetbrains.compose") 3 | id("com.android.application") 4 | kotlin("android") 5 | } 6 | 7 | dependencies { 8 | implementation(project(":demo:common")) 9 | implementation("androidx.activity:activity-compose:1.6.1") 10 | } 11 | 12 | android { 13 | compileSdk = 34 14 | defaultConfig { 15 | applicationId = "com.wakaztahir.android" 16 | minSdk = 21 17 | targetSdk = 33 18 | versionCode = 1 19 | versionName = "1.0.0" 20 | } 21 | compileOptions { 22 | sourceCompatibility = JavaVersion.VERSION_17 23 | targetCompatibility = JavaVersion.VERSION_17 24 | } 25 | namespace = "com.wakaztahir.android" 26 | } -------------------------------------------------------------------------------- /demo/android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 6 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | -------------------------------------------------------------------------------- /demo/android/src/main/java/com/wakaztahir/android/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package com.wakaztahir.android 2 | 3 | import android.os.Bundle 4 | import androidx.activity.ComponentActivity 5 | import androidx.activity.compose.setContent 6 | import androidx.compose.material3.MaterialTheme 7 | import com.wakaztahir.common.DisplayCodeEditor 8 | 9 | class MainActivity : ComponentActivity() { 10 | override fun onCreate(savedInstanceState: Bundle?) { 11 | super.onCreate(savedInstanceState) 12 | setContent { 13 | MaterialTheme { 14 | DisplayCodeEditor() 15 | } 16 | } 17 | } 18 | } -------------------------------------------------------------------------------- /demo/common/build.gradle.kts: -------------------------------------------------------------------------------- 1 | plugins { 2 | kotlin("multiplatform") 3 | id("org.jetbrains.compose") 4 | id("com.android.library") 5 | } 6 | 7 | kotlin { 8 | androidTarget() 9 | jvm("desktop") { 10 | compilations.all { 11 | kotlinOptions.jvmTarget = "17" 12 | } 13 | } 14 | js(IR) { 15 | browser() 16 | binaries.executable() 17 | } 18 | sourceSets { 19 | val commonMain by getting { 20 | dependencies { 21 | api(compose.runtime) 22 | api(compose.foundation) 23 | @OptIn(org.jetbrains.compose.ExperimentalComposeLibrary::class) 24 | api(compose.material3) 25 | implementation(project(":codeeditor")) 26 | } 27 | } 28 | val commonTest by getting { 29 | dependencies { 30 | implementation(kotlin("test")) 31 | } 32 | } 33 | val androidMain by getting 34 | // val androidTest by getting { 35 | // dependencies { 36 | // implementation("junit:junit:4.13") 37 | // } 38 | // } 39 | val desktopMain by getting { 40 | dependencies { 41 | api(compose.preview) 42 | } 43 | } 44 | val desktopTest by getting 45 | } 46 | } 47 | 48 | android { 49 | compileSdk = 34 50 | sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml") 51 | defaultConfig { 52 | minSdk = 21 53 | targetSdk = 31 54 | } 55 | compileOptions { 56 | sourceCompatibility = JavaVersion.VERSION_17 57 | targetCompatibility = JavaVersion.VERSION_17 58 | } 59 | namespace = "com.wakaztahir.common" 60 | } 61 | -------------------------------------------------------------------------------- /demo/common/src/androidMain/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /demo/desktop/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.compose.desktop.application.dsl.TargetFormat 2 | 3 | plugins { 4 | kotlin("multiplatform") 5 | id("org.jetbrains.compose") 6 | } 7 | 8 | kotlin { 9 | jvm { 10 | compilations.all { 11 | kotlinOptions.jvmTarget = "17" 12 | } 13 | } 14 | sourceSets { 15 | val jvmMain by getting { 16 | dependencies { 17 | implementation(project(":demo:common")) 18 | implementation(compose.desktop.currentOs) 19 | } 20 | } 21 | val jvmTest by getting 22 | } 23 | } 24 | 25 | compose.desktop { 26 | application { 27 | mainClass = "MainKt" 28 | nativeDistributions { 29 | targetFormats(TargetFormat.Dmg, TargetFormat.Msi, TargetFormat.Deb) 30 | packageName = "jvm" 31 | packageVersion = "1.0.0" 32 | } 33 | } 34 | } 35 | -------------------------------------------------------------------------------- /demo/desktop/src/jvmMain/kotlin/main.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.material.MaterialTheme 2 | import androidx.compose.ui.window.Window 3 | import androidx.compose.ui.window.application 4 | import com.wakaztahir.common.DisplayCodeEditor 5 | 6 | 7 | fun main() = application { 8 | Window(onCloseRequest = ::exitApplication) { 9 | MaterialTheme { 10 | DisplayCodeEditor() 11 | } 12 | } 13 | } -------------------------------------------------------------------------------- /demo/web/build.gradle.kts: -------------------------------------------------------------------------------- 1 | import org.jetbrains.compose.compose 2 | import org.jetbrains.compose.desktop.application.dsl.TargetFormat 3 | import org.jetbrains.kotlin.gradle.tasks.KotlinCompile 4 | import org.jetbrains.kotlin.gradle.targets.js.nodejs.NodeJsRootExtension 5 | 6 | plugins { 7 | kotlin("multiplatform") 8 | id("org.jetbrains.compose") 9 | } 10 | 11 | repositories { 12 | google() 13 | mavenCentral() 14 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 15 | } 16 | 17 | kotlin { 18 | js(IR) { 19 | browser { 20 | testTask { 21 | testLogging.showStandardStreams = true 22 | useKarma { 23 | useChromeHeadless() 24 | useFirefox() 25 | } 26 | } 27 | } 28 | binaries.executable() 29 | } 30 | sourceSets { 31 | val jsMain by getting { 32 | dependencies { 33 | implementation(compose.web.core) 34 | implementation(compose.runtime) 35 | implementation(project(":demo:common")) 36 | } 37 | } 38 | val jsTest by getting { 39 | dependencies { 40 | implementation(kotlin("test-js")) 41 | } 42 | } 43 | } 44 | } 45 | 46 | compose.experimental { 47 | web.application {} 48 | } 49 | 50 | //afterEvaluate { 51 | // rootProject.extensions.configure { 52 | // versions.webpackDevServer.version = "4.0.0" 53 | // versions.webpackCli.version = "4.9.0" 54 | // nodeVersion = "16.0.0" 55 | // } 56 | //} -------------------------------------------------------------------------------- /demo/web/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qawaz/compose-code-editor/a801d7a6c8674c5b56f95ffb30ce6d94b317ff71/demo/web/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /demo/web/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /demo/web/src/jsMain/kotlin/BrowserViewportWindow.kt: -------------------------------------------------------------------------------- 1 | // From Slack by OliverO 2 | // See: https://kotlinlang.slack.com/archives/C01F2HV7868/p1660083429206369?thread_ts=1660083398.571449&cid=C01F2HV7868 3 | 4 | @file:Suppress( 5 | "INVISIBLE_MEMBER", 6 | "INVISIBLE_REFERENCE", 7 | "EXPOSED_PARAMETER_TYPE" 8 | ) // WORKAROUND: ComposeWindow and ComposeLayer are internal 9 | 10 | import androidx.compose.runtime.Composable 11 | import androidx.compose.ui.window.ComposeWindow 12 | import kotlinx.browser.document 13 | import kotlinx.browser.window 14 | import org.w3c.dom.HTMLCanvasElement 15 | import org.w3c.dom.HTMLStyleElement 16 | import org.w3c.dom.HTMLTitleElement 17 | 18 | private const val CANVAS_ELEMENT_ID = "ComposeTarget" // Hardwired into ComposeWindow 19 | 20 | /** 21 | * A Skiko/Canvas-based top-level window using the browser's entire viewport. Supports resizing. 22 | */ 23 | fun BrowserViewportWindow( 24 | title: String = "Untitled", 25 | content: @Composable ComposeWindow.() -> Unit 26 | ) { 27 | val htmlHeadElement = document.head!! 28 | htmlHeadElement.appendChild( 29 | (document.createElement("style") as HTMLStyleElement).apply { 30 | type = "text/css" 31 | appendChild( 32 | document.createTextNode( 33 | """ 34 | html, body { 35 | overflow: hidden; 36 | margin: 0 !important; 37 | padding: 0 !important; 38 | } 39 | #$CANVAS_ELEMENT_ID { 40 | outline: none; 41 | } 42 | """.trimIndent() 43 | ) 44 | ) 45 | } 46 | ) 47 | 48 | fun HTMLCanvasElement.fillViewportSize() { 49 | setAttribute("width", "${window.innerWidth}") 50 | setAttribute("height", "${window.innerHeight}") 51 | } 52 | 53 | val canvas = (document.getElementById(CANVAS_ELEMENT_ID) as HTMLCanvasElement).apply { 54 | fillViewportSize() 55 | } 56 | 57 | ComposeWindow().apply { 58 | window.addEventListener("resize", { 59 | canvas.fillViewportSize() 60 | layer.layer.attachTo(canvas) 61 | val scale = layer.layer.contentScale 62 | layer.setSize((canvas.width / scale).toInt(), (canvas.height / scale).toInt()) 63 | layer.layer.needRedraw() 64 | }) 65 | 66 | // WORKAROUND: ComposeWindow does not implement `setTitle(title)` 67 | val htmlTitleElement = ( 68 | htmlHeadElement.getElementsByTagName("title").item(0) 69 | ?: document.createElement("title").also { htmlHeadElement.appendChild(it) } 70 | ) as HTMLTitleElement 71 | htmlTitleElement.textContent = title 72 | 73 | setContent { 74 | content(this) 75 | } 76 | } 77 | } -------------------------------------------------------------------------------- /demo/web/src/jsMain/kotlin/main.js.kt: -------------------------------------------------------------------------------- 1 | import androidx.compose.foundation.layout.Box 2 | import androidx.compose.foundation.layout.fillMaxSize 3 | import androidx.compose.material.MaterialTheme 4 | import androidx.compose.ui.Modifier 5 | import androidx.compose.ui.window.Window 6 | import com.wakaztahir.common.DisplayCodeEditor 7 | import org.jetbrains.skiko.wasm.onWasmReady 8 | 9 | fun main() { 10 | onWasmReady { 11 | BrowserViewportWindow("Code Editor") { 12 | MaterialTheme { 13 | Box(modifier = Modifier.fillMaxSize()) { 14 | DisplayCodeEditor() 15 | } 16 | } 17 | } 18 | } 19 | } 20 | 21 | 22 | -------------------------------------------------------------------------------- /demo/web/src/jsMain/resources/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | ComposeCodeEditorDemo 6 | 7 | 8 | 9 | 10 |
11 | 12 |
13 | 14 | 15 | 16 | -------------------------------------------------------------------------------- /demo/web/src/jsMain/resources/styles.css: -------------------------------------------------------------------------------- 1 | #root { 2 | width: 100%; 3 | height: 100vh; 4 | } 5 | 6 | #root > .compose-web-column > div { 7 | position: relative; 8 | } 9 | -------------------------------------------------------------------------------- /docs.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | # Fail on any error 4 | set -ex 5 | 6 | # Clear out the old API docs 7 | [ -d docs/api ] && rm -r docs/api 8 | 9 | # Build the docs with dokka 10 | ./gradlew dokkaHtmlMultiModule --stacktrace 11 | 12 | # Copy README.md to docs 13 | cp README.md ./docs/README.md 14 | 15 | # Deploy Docs 16 | mkdocs gh-deploy --force -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-clj/-lang-clj.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangClj 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangClj

30 |
31 |
fun LangClj()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-css/-lang-css.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangCss 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangCss

30 |
31 |
fun LangCss()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-dart/-lang-dart.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangDart 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangDart

30 |
31 |
fun LangDart()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-go/-lang-go.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangGo 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangGo

30 |
31 |
fun LangGo()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-hs/-lang-hs.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangHs 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangHs

30 |
31 |
fun LangHs()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-lisp/-lang-lisp.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangLisp 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangLisp

30 |
31 |
fun LangLisp()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-llvm/-lang-llvm.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangLlvm 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangLlvm

30 |
31 |
fun LangLlvm()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-lua/-lang-lua.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangLua 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangLua

30 |
31 |
fun LangLua()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-md/-lang-md.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangMd 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangMd

30 |
31 |
fun LangMd()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-ml/-lang-ml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangMl 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangMl

30 |
31 |
fun LangMl()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-n/-lang-n.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangN 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangN

30 |
31 |
fun LangN()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-r/-lang-r.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangR 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangR

30 |
31 |
fun LangR()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-rd/-lang-rd.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangRd 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangRd

30 |
31 |
fun LangRd()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-sql/-lang-sql.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangSql 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangSql

30 |
31 |
fun LangSql()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-tcl/-lang-tcl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangTcl 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangTcl

30 |
31 |
fun LangTcl()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-tex/-lang-tex.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangTex 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangTex

30 |
31 |
fun LangTex()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-vb/-lang-vb.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangVb 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangVb

30 |
31 |
fun LangVb()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-vhdl/-lang-vhdl.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangVhdl 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangVhdl

30 |
31 |
fun LangVhdl()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-wiki/-lang-wiki.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangWiki 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangWiki

30 |
31 |
fun LangWiki()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-xq/-lang-xq.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangXq 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangXq

30 |
31 |
fun LangXq()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang-yaml/-lang-yaml.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | LangYaml 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

LangYaml

30 |
31 |
fun LangYaml()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.lang/-lang/-lang.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Lang 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

Lang

30 |
31 |
fun Lang()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.prettify.parser/-prettify/-prettify.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | Prettify 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

Prettify

30 |
31 |
fun Prettify()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-code-theme/-code-theme.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | CodeTheme 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

CodeTheme

30 |
31 |
fun CodeTheme()
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-code-theme/colors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | colors 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

colors

30 |
31 |
abstract val colors: SyntaxColors
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-default-theme/colors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | colors 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

colors

30 |
31 |
open override val colors: SyntaxColors
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-monokai-theme/colors.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | colors 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

colors

30 |
31 |
open override val colors: SyntaxColors
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/comment.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | comment 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

comment

30 |
31 |
val comment: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/keyword.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | keyword 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

keyword

30 |
31 |
val keyword: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/literal.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | literal 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

literal

30 |
31 |
val literal: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/nocode.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | nocode 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

nocode

30 |
31 |
val nocode: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/plain.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | plain 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

plain

30 |
31 |
val plain: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/source.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | source 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

source

30 |
31 |
val source: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/string.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | string 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

string

30 |
31 |
val string: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/tag.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | tag 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

tag

30 |
31 |
val tag: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/codeeditor/com.wakaztahir.codeeditor.theme/-syntax-colors/type.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | type 5 | 6 | 11 | 12 | 13 | 21 |
22 |
23 |
24 |
25 |
26 |
27 | 28 |
29 |

type

30 |
31 |
val type: Color
32 |
33 | 34 |
35 |
36 | 37 | 38 | 39 | 40 | -------------------------------------------------------------------------------- /docs/api/images/anchor-copy-button.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/api/images/arrow_down.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/api/images/copy-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/api/images/copy-successful-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/api/images/footer-go-to-link.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /docs/api/images/go-to-top-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | -------------------------------------------------------------------------------- /docs/api/images/logo-icon.svg: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /docs/api/images/theme-toggle.svg: -------------------------------------------------------------------------------- 1 | 2 | 4 | -------------------------------------------------------------------------------- /docs/api/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | All modules 5 | 10 | 11 | 12 | 20 |
21 |
22 |
23 |
24 |
25 |
26 | 27 |
28 |

All modules:

29 |
30 |
31 |
32 |
33 | 34 | 35 |
Link copied to clipboard
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | 44 |
45 |
46 | 47 | 48 | 49 | -------------------------------------------------------------------------------- /docs/api/package-list: -------------------------------------------------------------------------------- 1 | $dokka.format:html-v1 2 | $dokka.linkExtension:html 3 | 4 | module:codeeditor 5 | com.wakaztahir.codeeditor.model 6 | com.wakaztahir.codeeditor.parser 7 | com.wakaztahir.codeeditor.prettify 8 | com.wakaztahir.codeeditor.prettify.lang 9 | com.wakaztahir.codeeditor.prettify.parser 10 | com.wakaztahir.codeeditor.theme 11 | com.wakaztahir.codeeditor.utils 12 | -------------------------------------------------------------------------------- /docs/api/scripts/clipboard.js: -------------------------------------------------------------------------------- 1 | window.addEventListener('load', () => { 2 | document.querySelectorAll('span.copy-icon').forEach(element => { 3 | element.addEventListener('click', (el) => copyElementsContentToClipboard(element)); 4 | }) 5 | 6 | document.querySelectorAll('span.anchor-icon').forEach(element => { 7 | element.addEventListener('click', (el) => { 8 | if(element.hasAttribute('pointing-to')){ 9 | const location = hrefWithoutCurrentlyUsedAnchor() + '#' + element.getAttribute('pointing-to') 10 | copyTextToClipboard(element, location) 11 | } 12 | }); 13 | }) 14 | }) 15 | 16 | const copyElementsContentToClipboard = (element) => { 17 | const selection = window.getSelection(); 18 | const range = document.createRange(); 19 | range.selectNodeContents(element.parentNode.parentNode); 20 | selection.removeAllRanges(); 21 | selection.addRange(range); 22 | 23 | copyAndShowPopup(element, () => selection.removeAllRanges()) 24 | } 25 | 26 | const copyTextToClipboard = (element, text) => { 27 | var textarea = document.createElement("textarea"); 28 | textarea.textContent = text; 29 | textarea.style.position = "fixed"; 30 | document.body.appendChild(textarea); 31 | textarea.select(); 32 | 33 | copyAndShowPopup(element, () => document.body.removeChild(textarea)) 34 | } 35 | 36 | const copyAndShowPopup = (element, after) => { 37 | try { 38 | document.execCommand('copy'); 39 | element.nextElementSibling.classList.add('active-popup'); 40 | setTimeout(() => { 41 | element.nextElementSibling.classList.remove('active-popup'); 42 | }, 1200); 43 | } catch (e) { 44 | console.error('Failed to write to clipboard:', e) 45 | } 46 | finally { 47 | if(after) after() 48 | } 49 | } 50 | 51 | const hrefWithoutCurrentlyUsedAnchor = () => window.location.href.split('#')[0] 52 | 53 | -------------------------------------------------------------------------------- /docs/api/scripts/navigation-loader.js: -------------------------------------------------------------------------------- 1 | navigationPageText = fetch(pathToRoot + "navigation.html").then(response => response.text()) 2 | 3 | displayNavigationFromPage = () => { 4 | navigationPageText.then(data => { 5 | document.getElementById("sideMenu").innerHTML = data; 6 | }).then(() => { 7 | document.querySelectorAll(".overview > a").forEach(link => { 8 | link.setAttribute("href", pathToRoot + link.getAttribute("href")); 9 | }) 10 | }).then(() => { 11 | document.querySelectorAll(".sideMenuPart").forEach(nav => { 12 | if (!nav.classList.contains("hidden")) 13 | nav.classList.add("hidden") 14 | }) 15 | }).then(() => { 16 | revealNavigationForCurrentPage() 17 | }) 18 | document.querySelectorAll('.footer a[href^="#"]').forEach(anchor => { 19 | anchor.addEventListener('click', function (e) { 20 | e.preventDefault(); 21 | document.querySelector(this.getAttribute('href')).scrollIntoView({ 22 | behavior: 'smooth' 23 | }); 24 | }); 25 | }); 26 | } 27 | 28 | revealNavigationForCurrentPage = () => { 29 | let pageId = document.getElementById("content").attributes["pageIds"].value.toString(); 30 | let parts = document.querySelectorAll(".sideMenuPart"); 31 | let found = 0; 32 | do { 33 | parts.forEach(part => { 34 | if (part.attributes['pageId'].value.indexOf(pageId) !== -1 && found === 0) { 35 | found = 1; 36 | if (part.classList.contains("hidden")) { 37 | part.classList.remove("hidden"); 38 | part.setAttribute('data-active', ""); 39 | } 40 | revealParents(part) 41 | } 42 | }); 43 | pageId = pageId.substring(0, pageId.lastIndexOf("/")) 44 | } while (pageId.indexOf("/") !== -1 && found === 0) 45 | }; 46 | revealParents = (part) => { 47 | if (part.classList.contains("sideMenuPart")) { 48 | if (part.classList.contains("hidden")) 49 | part.classList.remove("hidden"); 50 | revealParents(part.parentNode) 51 | } 52 | }; 53 | 54 | /* 55 | This is a work-around for safari being IE of our times. 56 | It doesn't fire a DOMContentLoaded, presumabely because eventListener is added after it wants to do it 57 | */ 58 | if (document.readyState == 'loading') { 59 | window.addEventListener('DOMContentLoaded', () => { 60 | displayNavigationFromPage() 61 | }) 62 | } else { 63 | displayNavigationFromPage() 64 | } -------------------------------------------------------------------------------- /docs/api/scripts/sourceset_dependencies.js: -------------------------------------------------------------------------------- 1 | sourceset_dependencies = '{":codeeditor:dokkaHtmlPartial/androidAndroidTestRelease":[],":codeeditor:dokkaHtmlPartial/androidDebug":[],":codeeditor:dokkaHtmlPartial/androidMain":[":codeeditor:dokkaHtmlPartial/commonMain"],":codeeditor:dokkaHtmlPartial/androidRelease":[],":codeeditor:dokkaHtmlPartial/commonMain":[],":codeeditor:dokkaHtmlPartial/desktopMain":[":codeeditor:dokkaHtmlPartial/commonMain"]}' -------------------------------------------------------------------------------- /docs/api/styles/jetbrains-mono.css: -------------------------------------------------------------------------------- 1 | @font-face{ 2 | font-family: 'JetBrains Mono'; 3 | src: url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/fonts/web/JetBrainsMono-Regular.eot') format('embedded-opentype'), 4 | url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/fonts/webfonts/JetBrainsMono-Regular.woff2') format('woff2'), 5 | url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/fonts/ttf/JetBrainsMono-Regular.ttf') format('truetype'); 6 | font-weight: normal; 7 | font-style: normal; 8 | } 9 | 10 | @font-face{ 11 | font-family: 'JetBrains Mono'; 12 | src: url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/fonts/web/JetBrainsMono-Bold.eot') format('embedded-opentype'), 13 | url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/fonts/webfonts/JetBrainsMono-Bold.woff2') format('woff2'), 14 | url('https://raw.githubusercontent.com/JetBrains/JetBrainsMono/master/fonts/ttf/JetBrainsMono-Bold.ttf') format('truetype'); 15 | font-weight: bold; 16 | font-style: bold; 17 | } -------------------------------------------------------------------------------- /docs/api/styles/logo-styles.css: -------------------------------------------------------------------------------- 1 | .library-name a { 2 | position: relative; 3 | margin-left: 55px; 4 | } 5 | 6 | .library-name a::before { 7 | content: ''; 8 | background: url("../images/logo-icon.svg") center no-repeat; 9 | background-size: contain; 10 | position: absolute; 11 | width: 50px; 12 | height: 50px; 13 | top: -18px; 14 | left: -55px; 15 | } -------------------------------------------------------------------------------- /docs/api/styles/prism.css: -------------------------------------------------------------------------------- 1 | :root { 2 | --keyword-color: #07a; 3 | --property-color: #905; 4 | --function-color: #DD4A68; 5 | } 6 | 7 | :root.theme-dark { 8 | --keyword-color: #cc7832; 9 | --property-color: #9876aa; 10 | --function-color: #ffc66d; 11 | } 12 | 13 | code .token { 14 | white-space: pre; 15 | } 16 | 17 | /* PrismJS 1.24.1 18 | https://prismjs.com/download.html#themes=prism&languages=clike+java+javadoclike+kotlin&plugins=keep-markup */ 19 | /** 20 | * prism.js default theme for JavaScript, CSS and HTML 21 | * Based on dabblet (http://dabblet.com) 22 | * @author Lea Verou 23 | */ 24 | 25 | .token.comment, 26 | .token.prolog, 27 | .token.doctype, 28 | .token.cdata { 29 | color: slategray; 30 | } 31 | 32 | .token.punctuation { 33 | color: #999; 34 | } 35 | 36 | .token.namespace { 37 | opacity: .7; 38 | } 39 | 40 | .token.property, 41 | .token.tag, 42 | .token.boolean, 43 | .token.number, 44 | .token.constant, 45 | .token.symbol, 46 | .token.deleted { 47 | color: var(--property-color); 48 | } 49 | 50 | .token.selector, 51 | .token.attr-name, 52 | .token.string, 53 | .token.char, 54 | .token.builtin, 55 | .token.annotation, 56 | .token.inserted { 57 | color: #690; 58 | } 59 | 60 | .token.operator, 61 | .token.entity, 62 | .token.url, 63 | .language-css .token.string, 64 | .style .token.string { 65 | color: #9a6e3a; 66 | /* This background color was intended by the author of this theme. */ 67 | /*background: hsla(0, 0%, 100%, .5);*/ 68 | } 69 | 70 | .token.atrule, 71 | .token.attr-value, 72 | .token.keyword { 73 | color: var(--keyword-color); 74 | font-size: inherit; /* to override .keyword */ 75 | } 76 | 77 | .token.function, 78 | .token.class-name { 79 | color: var(--function-color); 80 | } 81 | 82 | .token.regex, 83 | .token.important, 84 | .token.variable { 85 | color: #e90; 86 | } 87 | 88 | .token.important, 89 | .token.bold { 90 | font-weight: bold; 91 | } 92 | .token.italic { 93 | font-style: italic; 94 | } 95 | 96 | .token.entity { 97 | cursor: help; 98 | } 99 | 100 | .annotation,.control,.field,.filename,.keyword,.menupath,.property,.string,.value { 101 | color: #27282c; 102 | font-weight: 700; 103 | } -------------------------------------------------------------------------------- /gradle.properties: -------------------------------------------------------------------------------- 1 | kotlin.code.style=official 2 | android.useAndroidX=true 3 | version=3.1.3 4 | versionCode=3 5 | kotlin.version=1.9.0 6 | agp.version=8.0.0 7 | compose.version=1.5.0 8 | org.jetbrains.compose.experimental.jscanvas.enabled=true 9 | kotlin.mpp.androidSourceSetLayoutVersion=2 -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Qawaz/compose-code-editor/a801d7a6c8674c5b56f95ffb30ce6d94b317ff71/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip 4 | zipStoreBase=GRADLE_USER_HOME 5 | zipStorePath=wrapper/dists 6 | -------------------------------------------------------------------------------- /gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | 17 | @if "%DEBUG%" == "" @echo off 18 | @rem ########################################################################## 19 | @rem 20 | @rem Gradle startup script for Windows 21 | @rem 22 | @rem ########################################################################## 23 | 24 | @rem Set local scope for the variables with windows NT shell 25 | if "%OS%"=="Windows_NT" setlocal 26 | 27 | set DIRNAME=%~dp0 28 | if "%DIRNAME%" == "" set DIRNAME=. 29 | set APP_BASE_NAME=%~n0 30 | set APP_HOME=%DIRNAME% 31 | 32 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 33 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 34 | 35 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 36 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 37 | 38 | @rem Find java.exe 39 | if defined JAVA_HOME goto findJavaFromJavaHome 40 | 41 | set JAVA_EXE=java.exe 42 | %JAVA_EXE% -version >NUL 2>&1 43 | if "%ERRORLEVEL%" == "0" goto execute 44 | 45 | echo. 46 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 47 | echo. 48 | echo Please set the JAVA_HOME variable in your environment to match the 49 | echo location of your Java installation. 50 | 51 | goto fail 52 | 53 | :findJavaFromJavaHome 54 | set JAVA_HOME=%JAVA_HOME:"=% 55 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 56 | 57 | if exist "%JAVA_EXE%" goto execute 58 | 59 | echo. 60 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 61 | echo. 62 | echo Please set the JAVA_HOME variable in your environment to match the 63 | echo location of your Java installation. 64 | 65 | goto fail 66 | 67 | :execute 68 | @rem Setup the command line 69 | 70 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 71 | 72 | 73 | @rem Execute Gradle 74 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 75 | 76 | :end 77 | @rem End local scope for the variables with windows NT shell 78 | if "%ERRORLEVEL%"=="0" goto mainEnd 79 | 80 | :fail 81 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 82 | rem the _cmd.exe /c_ return code! 83 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 84 | exit /b 1 85 | 86 | :mainEnd 87 | if "%OS%"=="Windows_NT" endlocal 88 | 89 | :omega 90 | -------------------------------------------------------------------------------- /jitpack.yml: -------------------------------------------------------------------------------- 1 | jdk: 2 | - openjdk11 -------------------------------------------------------------------------------- /mkdocs.yml: -------------------------------------------------------------------------------- 1 | site_name: Compose Code Editor 2 | site_description: 'Jetpack Compose Code Editor' 3 | site_author: 'Waqas Tahir' 4 | site_url: 'https://qawaz.github.io/compose-code-editor/' 5 | remote_branch: gh-pages 6 | 7 | docs_dir: docs 8 | 9 | repo_name: 'compose-code-editor' 10 | repo_url: 'https://github.com/qawaz/compose-code-editor' 11 | 12 | theme: 13 | name: material 14 | markdown_extensions: 15 | - pymdownx.highlight: 16 | anchor_linenums: true 17 | - pymdownx.inlinehilite 18 | - pymdownx.snippets 19 | - pymdownx.superfences 20 | nav: 21 | - 'Overview': README.md 22 | - 'API' : api/codeeditor -------------------------------------------------------------------------------- /settings.gradle.kts: -------------------------------------------------------------------------------- 1 | pluginManagement { 2 | repositories { 3 | google() 4 | gradlePluginPortal() 5 | mavenCentral() 6 | maven("https://maven.pkg.jetbrains.space/public/p/compose/dev") 7 | } 8 | plugins { 9 | kotlin("jvm").version(extra["kotlin.version"] as String) 10 | kotlin("android").version(extra["kotlin.version"] as String) 11 | kotlin("multiplatform").version(extra["kotlin.version"] as String) 12 | id("com.android.application").version(extra["agp.version"] as String) 13 | id("com.android.library").version(extra["agp.version"] as String) 14 | id("org.jetbrains.compose").version(extra["compose.version"] as String) 15 | id("org.jetbrains.dokka").version("1.7.20") 16 | } 17 | } 18 | rootProject.name = "ComposeCodeEditor" 19 | 20 | include(":demo:android") 21 | include(":demo:desktop") 22 | include(":demo:common") 23 | include(":demo:web") 24 | include(":codeeditor") 25 | 26 | --------------------------------------------------------------------------------