Skip to content

Commit

Permalink
add CodeBlock in lang html
Browse files Browse the repository at this point in the history
  • Loading branch information
HanzoDev1375 committed Jul 2, 2024
1 parent 6350fdb commit e40fbb2
Show file tree
Hide file tree
Showing 7 changed files with 8,148 additions and 7,711 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -250,24 +250,32 @@ public void analyze(
result.addIfNeeded(line, column, EditorColorScheme.HTML_TAG);
break;
case HTMLLexer.GT:
result.addIfNeeded(line, column, EditorColorScheme.KEYWORD);
break;
case HTMLLexer.LT:
{
{
result.addIfNeeded(line, column, EditorColorScheme.KEYWORD);
var block = result.obtainNewBlock();
block.startLine = line;
block.startColumn = column;
stack.push(block);

break;
}

//// '/>'
case HTMLLexer.SLASH_CLOSE:
result.addIfNeeded(line, column, EditorColorScheme.KEYWORD);
break;

/// '</'
case HTMLLexer.OPEN_SLASH:
{
result.addIfNeeded(line, column, EditorColorScheme.KEYWORD);
if (!stack.isEmpty()) {
BlockLine block = stack.pop();
final var block = stack.pop();
block.endLine = line;
block.endColumn = column;
if (block.startLine != block.endLine) {
if (preToken.getLine() == token.getLine()) block.toBottomOfEndLine = true;
result.addBlockLine(block);
}
}
result.addBlockLine(block);

break;
}
case HTMLLexer.IDENTIFIER:
Expand Down Expand Up @@ -301,15 +309,14 @@ public void analyze(
if (previous == HTMLLexer.CASE || previous == HTMLLexer.FINAL) {
colorid = EditorColorScheme.ATTRIBUTE_NAME;
}
// show '<'
if (previous == HTMLLexer.LT) {
colorid = EditorColorScheme.KEYWORD;
BlockLine block = new BlockLine();
block.startLine = preToken.getLine() - 1;
block.startColumn = preToken.getCharPositionInLine(); // -1 for '<'
stack.push(block);
colorid = EditorColorScheme.OPERATOR;
}
if (previous == HTMLLexer.DIV) {
colorid = EditorColorScheme.KEYWORD;
// end '</'
if (previous == HTMLLexer.OPEN_SLASH) {
colorid = EditorColorScheme.OPERATOR;

}

ListCss3Color.initColor(token, line, column, result, true);
Expand Down Expand Up @@ -344,18 +351,6 @@ public void analyze(
case HTMLLexer.DIV:
{
result.addIfNeeded(line, column, EditorColorScheme.KEYWORD);
if (previous == HTMLLexer.LT) {
if (!stack.isEmpty()) {
BlockLine blocks = stack.pop();
blocks.endLine = preToken.getLine() - 1;
blocks.endColumn = preToken.getCharPositionInLine();
if (blocks.startLine != blocks.endLine) {
if (prePreToken.getLine() == preToken.getLine())
blocks.toBottomOfEndLine = true;
result.addBlockLine(blocks);
}
}
}
break;
}
case HTMLLexer.COLORSSS:
Expand Down
Loading

0 comments on commit e40fbb2

Please sign in to comment.