private void grammarTextPaneKeyReleased(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_grammarTextPaneKeyReleased
        if (evt != null && isArrowKeyCode(evt.getKeyCode())) {
            return;
        }

        try {
            grammarParser.parse(grammarTextPane.getText());
        } catch (Exception ex) {
            System.out.println("Caught exception during parsing: " + ex.getMessage());
            return;
        }

        grammarTextPane.getHighlighter().removeAllHighlights();

        if (grammarParser.hasErrors()) {
            for (ParserError error : grammarParser.getErrors()) {
                highlightErrorLine(error.getLineIndex(), grammarTextPane);
            }
        } else {
            graphPanel.setNetworkGraph(grammarParser.getGraph());
            graphPanel.repaint();
        }

        initialisationTextPaneKeyReleased(null);
    }//GEN-LAST:event_grammarTextPaneKeyReleased