Skip to content

Commit

Permalink
Merge branch 'master' into highprecision
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbattle committed Dec 13, 2023
2 parents e369c43 + 333ee2b commit 1698dd8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 25 deletions.
5 changes: 1 addition & 4 deletions lsp/src/main/java/workspace/DAPWorkspaceManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -107,9 +107,6 @@ public class DAPWorkspaceManager
* These are the only property names that can sensibly set via the DAP launch.
*/
private static List<String> propertyNames = Arrays.asList(
"vdmj.annotations.packages",
"vdmj.annotations.debug",
"vdmj.mapping.search_path",
"vdmj.scheduler.fcfs_timeslice",
"vdmj.scheduler.virtual_timeslice",
"vdmj.scheduler.jitter",
Expand Down Expand Up @@ -284,7 +281,7 @@ private void processSettings(DAPRequest request)
}
}

// System properties above override those from the properties file
// System properties above override those from any properties file
Diag.info("Reading properties from %s", LSPWorkspaceManager.PROPERTIES);
Properties.init(LSPWorkspaceManager.PROPERTIES);
}
Expand Down
39 changes: 20 additions & 19 deletions vdmj/src/main/java/com/fujitsu/vdmj/syntax/SyntaxReader.java
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ public abstract class SyntaxReader
/** The maximum number of syntax errors allowed in one Reader. */
private static final int MAX = 100;

/** A list of class names from the vdmj.annotations resource file */
private static List<String> annotationClasses = null;

/**
Expand Down Expand Up @@ -408,13 +409,16 @@ private ASTAnnotation readAnnotation(LexTokenReader ltr) throws LexException, Pa

protected void trailingAnnotationCheck() throws LexException, ParserException
{
ASTAnnotationList trailing = readAnnotations(getComments());

if (!trailing.isEmpty())
if (getErrorCount() == 0) // Avoid confusing annotation warnings, if spec invalid
{
for (ASTAnnotation annotation: trailing)
ASTAnnotationList trailing = readAnnotations(getComments());

if (!trailing.isEmpty())
{
warning(5038, "Trailing annotation ignored: " + annotation, annotation.name.location);
for (ASTAnnotation annotation: trailing)
{
warning(5038, "Trailing annotation ignored: " + annotation, annotation.name.location);
}
}
}
}
Expand Down Expand Up @@ -832,24 +836,21 @@ protected ASTAnnotation loadAnnotation(LexIdentifierToken name)
* annotations to be in any package, though the AST<name>Annotation rule remains.
*/

if (annotationClasses != null)
for (String annotationClass: annotationClasses)
{
for (String annotationClass: annotationClasses)
try
{
try
if (annotationClass.endsWith("." + astName))
{
if (annotationClass.endsWith("." + astName))
{
Class<?> clazz = Class.forName(annotationClass);
Constructor<?> ctor = clazz.getConstructor(LexIdentifierToken.class);
return (ASTAnnotation) ctor.newInstance(name);
}
}
catch (Exception e)
{
throwMessage(2334, "Failed to instantiate " + astName);
Class<?> clazz = Class.forName(annotationClass);
Constructor<?> ctor = clazz.getConstructor(LexIdentifierToken.class);
return (ASTAnnotation) ctor.newInstance(name);
}
}
catch (Exception e)
{
throwMessage(2334, "Failed to instantiate " + astName);
}
}

throwMessage(2334, "Cannot find " + astName + " on " + classpath);
Expand All @@ -858,7 +859,7 @@ protected ASTAnnotation loadAnnotation(LexIdentifierToken name)

protected LexCommentList getComments()
{
return reader.getComments();
return reader.getComments(); // Also clears comments
}

protected boolean isReserved(String name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
import com.fujitsu.vdmj.lex.LexLocation;
import com.fujitsu.vdmj.tc.definitions.TCDefinition;
import com.fujitsu.vdmj.tc.definitions.TCDefinitionList;
import com.fujitsu.vdmj.tc.definitions.TCStateDefinition;
import com.fujitsu.vdmj.tc.modules.visitors.TCImportExportVisitor;
import com.fujitsu.vdmj.typechecker.Environment;

Expand All @@ -47,7 +46,7 @@ public TCDefinitionList getDefinition(TCDefinitionList actualDefs)

for (TCDefinition d: actualDefs)
{
if (!(d instanceof TCStateDefinition)) // Everything except state defs
// if (!(d instanceof TCStateDefinition)) // Everything except state defs
{
list.add(d);
}
Expand Down

0 comments on commit 1698dd8

Please sign in to comment.