
org.fife.tmm.UseCOperatorsAction Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of tokenmakermaker Show documentation
Show all versions of tokenmakermaker Show documentation
An application to easily create syntax highlighting for custom languages in RSyntaxTextArea.
The newest version!
package org.fife.tmm;
import java.awt.event.ActionEvent;
import java.util.ArrayList;
import java.util.List;
import org.fife.ui.app.AppAction;
/**
* Action that sets the operators table to contain only the C language's
* operators.
*
* @author Robert Futrell
* @version 1.0
*/
class UseCOperatorsAction extends AppAction {
private WordsTable table;
UseCOperatorsAction(TokenMakerMaker tmm, WordsTable table) {
super(tmm, tmm.getResourceBundle(), "Button.COperators");
this.table = table;
}
@Override
public void actionPerformed(ActionEvent e) {
table.setWords(createOperatorList());
}
/**
* Creates a list of all C operators, except trigraphs.
*
* @return The list of operators.
*/
private List createOperatorList() {
List list = new ArrayList<>();
// Don't add trigraphs, what are the odds they want those?
list.add("=");
list.add("+");
list.add("-");
list.add("*");
list.add("/");
list.add("%");
list.add("~");
list.add("<");
list.add(">");
list.add("<<");
list.add(">>");
list.add("==");
list.add("+=");
list.add("-=");
list.add("*=");
list.add("/=");
list.add("%=");
list.add(">>=");
list.add("<<=");
list.add("^");
list.add("&");
list.add("&&");
list.add("|");
list.add("||");
list.add("?");
list.add(":");
list.add(",");
list.add("!");
list.add("++");
list.add("--");
return list;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy