I created a Summer project for myself and decided that I wanted to write a simple text/code editor. I think everything has been going well so far. I created a basic GUI and can do simple operations like Open, Save, and Create files.
Right now I am doing syntax highlighting by reading the words as I open a file but this has turned out to be really messy and it doesn’t highlight the syntax if someone is just typing in the GUI.
So I’d like some ideas of how to go about syntax highlighting so that it works for both opening files and typing in the window.
Also, if anyone has any time I’d love to hear comments about my code, this is the repository: https://mcmillhj.beanstalkapp.com/jtexteditor/browse
The main files are JTextEditor.java and ui/JTextEditorUI.java
I think you should start reading about lexical analysis , you can also use JLex for getting tokens from the content of the file … you should also read a bit about compilers (which is not going to be easy)