• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Camelcade / Perl5-IDEA / #525521519

21 Apr 2025 01:57PM UTC coverage: 82.17% (+0.01%) from 82.156%
#525521519

push

github

hurricup
CAMELCADE-22634 Cleanup

8 of 8 new or added lines in 2 files covered. (100.0%)

102 existing lines in 15 files now uncovered.

30868 of 37566 relevant lines covered (82.17%)

0.82 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

92.0
/plugin/core/src/main/java/com/perl5/lang/perl/PerlParserDefinition.java
1
/*
2
 * Copyright 2015-2025 Alexandr Evstigneev
3
 *
4
 * Licensed under the Apache License, Version 2.0 (the "License");
5
 * you may not use this file except in compliance with the License.
6
 * You may obtain a copy of the License at
7
 *
8
 * http://www.apache.org/licenses/LICENSE-2.0
9
 *
10
 * Unless required by applicable law or agreed to in writing, software
11
 * distributed under the License is distributed on an "AS IS" BASIS,
12
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
 * See the License for the specific language governing permissions and
14
 * limitations under the License.
15
 */
16

17
package com.perl5.lang.perl;
18

19
import com.intellij.lang.ASTNode;
20
import com.intellij.lang.ParserDefinition;
21
import com.intellij.lang.PsiParser;
22
import com.intellij.lexer.Lexer;
23
import com.intellij.openapi.project.Project;
24
import com.intellij.psi.FileViewProvider;
25
import com.intellij.psi.PsiElement;
26
import com.intellij.psi.PsiFile;
27
import com.intellij.psi.tree.IElementType;
28
import com.intellij.psi.tree.IFileElementType;
29
import com.intellij.psi.tree.TokenSet;
30
import com.perl5.lang.perl.lexer.PerlElementTypes;
31
import com.perl5.lang.perl.lexer.PerlLexer;
32
import com.perl5.lang.perl.lexer.PerlLexingContext;
33
import com.perl5.lang.perl.lexer.PerlTokenSetsEx;
34
import com.perl5.lang.perl.lexer.adapters.PerlMergingLexerAdapter;
35
import com.perl5.lang.perl.parser.PerlParserImpl;
36
import com.perl5.lang.perl.parser.elementTypes.PsiElementProvider;
37
import com.perl5.lang.perl.psi.PerlLexerAwareParserDefinition;
38
import com.perl5.lang.perl.psi.impl.PerlFileImpl;
39
import com.perl5.lang.perl.psi.stubs.PerlStubElementTypes;
40
import org.jetbrains.annotations.NotNull;
41

42
import static com.perl5.lang.perl.lexer.PerlLexer.*;
43

44
public class PerlParserDefinition implements ParserDefinition, PerlElementTypes, PerlLexerAwareParserDefinition {
1✔
45

46
  @Override
47
  public @NotNull Lexer createLexer(Project project) {
48
    return new PerlMergingLexerAdapter(PerlLexingContext.create(project));
1✔
49
  }
50

51
  @Override
52
  public @NotNull TokenSet getWhitespaceTokens() {
53
    return PerlTokenSetsEx.getWHITE_SPACES();
1✔
54
  }
55

56
  @Override
57
  public @NotNull TokenSet getCommentTokens() {
58
    return PerlTokenSetsEx.getCOMMENTS();
1✔
59
  }
60

61
  @Override
62
  public @NotNull TokenSet getStringLiteralElements() {
63
    return PerlTokenSetsEx.getLITERALS();
1✔
64
  }
65

66
  @Override
67
  public @NotNull PsiParser createParser(final Project project) {
68
    return PerlParserImpl.INSTANCE;
1✔
69
  }
70

71
  @Override
72
  public @NotNull IFileElementType getFileNodeType() {
73
    return PerlStubElementTypes.FILE;
1✔
74
  }
75

76
  @Override
77
  public @NotNull PsiFile createFile(@NotNull FileViewProvider viewProvider) {
78
    return new PerlFileImpl(viewProvider);
1✔
79
  }
80

81
  @Override
82
  public @NotNull SpaceRequirements spaceExistenceTypeBetweenTokens(ASTNode left, ASTNode right) {
83
    return SpaceRequirements.MAY;
1✔
84
  }
85

86
  @Override
87
  public @NotNull PsiElement createElement(ASTNode node) {
88
    try {
89
      return ((PsiElementProvider)node.getElementType()).getPsiElement(node);
1✔
90
    }
UNCOV
91
    catch (Exception e) {
×
UNCOV
92
      throw new RuntimeException("Problem with node " + node, e);
×
93
    }
94
  }
95

96
  @Override
97
  public int getLexerStateFor(@NotNull ASTNode contextNode, @NotNull IElementType elementType) {
98
    if (elementType == HASH_INDEX) {
1✔
99
      return AFTER_VARIABLE;
1✔
100
    }
101
    else if (elementType == COMMENT_ANNOTATION) {
1✔
102
      return ANNOTATION;
1✔
103
    }
104
    else if (elementType == HEREDOC_QQ) {
1✔
105
      return STRING_QQ;
1✔
106
    }
107
    else if (elementType == HEREDOC_QX) {
1✔
108
      return STRING_QX;
1✔
109
    }
110
    else if (elementType == HEREDOC) {
1✔
111
      return STRING_Q;
1✔
112
    }
113
    else if (elementType == PARSABLE_STRING_USE_VARS) {
1✔
114
      return USE_VARS_STRING;
1✔
115
    }
116
    return PerlLexer.YYINITIAL;
1✔
117
  }
118
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc