public class JmlMarkerDecision
extends java.lang.Object
isComment(String)
Constructor and Description |
---|
JmlMarkerDecision(JmlLexer lexer)
Initialize this class with default
enabledKeys of "key" . |
Modifier and Type | Method and Description |
---|---|
java.util.Collection<java.lang.String> |
getEnabledKeys() |
boolean |
isActiveJmlSpec(java.lang.String foundKeys) |
boolean |
isComment(java.lang.String expectedCommentStart)
Lookahead for determining if we are at the start of comment and not a "JML expectedCommentStart".
|
void |
setEnabledKeys(java.util.Collection<java.lang.String> markers)
Sets the enabled keys for the recognition of active JML comments.
|
public JmlMarkerDecision(JmlLexer lexer)
enabledKeys
of "key"
.lexer
- a lexer instance which stream is usedpublic void setEnabledKeys(@Nonnull java.util.Collection<java.lang.String> markers)
markers
- a collection of keys without prefix ([+-])public java.util.Collection<java.lang.String> getEnabledKeys()
public boolean isComment(java.lang.String expectedCommentStart)
This method reads from the input stream to check the annotation markers between the comment start and the "@" This method returns true for expectedCommentStart "//" if we the comment begins with
(same for "/*")
It returns true if expectedCommentStart is followed by a sequence of "+", "-" or Java identifier characters, and then "@" and the sequence does not contain "-key".
It implements JML Ref Manual 4.4:
An annotation-key is a + or - sign followed by an ident (see section 4.6 Tokens). Note that
no white space can appear within, before, or after the annotation-key. Tools will provide a
way to enable a selection of annotation-key identifiers. These identifiers, hereafter called
"keys" provide for conditional inclusion of JML annotations as follows:
This method resets the position on the input stream (mark/rewind).
public boolean isActiveJmlSpec(java.lang.String foundKeys)
Copyright © 2003-2019 The KeY-Project.