Coder Social home page Coder Social logo

lgolding / auto-scale Goto Github PK

View Code? Open in Web Editor NEW
0.0 0.0 0.0 252 KB

A Visual Studio language service for the language used to write autoscale formulas for the Microsoft Azure Batch service

License: Apache License 2.0

C# 97.91% HTML 1.32% CSS 0.77%

auto-scale's People

Contributors

lgolding avatar

Watchers

 avatar

auto-scale's Issues

Reset tokenInfo.Trigger before OR-ing in new triggers

The language service seems to reuse the same TokenInfo object each time it calls the Scanner. So be sure to set the Trigger property to TokenTriggers.None before OR-ing in the appropriate triggers, if any, for the current token.

Failing to do this meant that the triggers were accumulated from call to call. So, for example, once a ParenClose token was seen, all subsequent tokens had the TokenTriggers.MatchBraces flag set. This caused the language service to do more work than it needed to (attempting to match braces after every token).

Parse error reported for "End" token

Repro:

^ = 1;\n

This should produce one error (ASF0001 (0-0): Expected a token of type Identifier, but got token "^" of type Unknown.). But it produces an additional, spurious error (ASF0001 (7-7): Expected a token of type Identifier, but got token "" of type End.).

This does not happen if the trailing newline is omitted, and it does not happen if the assignment statement is correct (a = 1).

Implement rule: Can't assign to sampling functions

For example, this is illegal:

$ActiveTasks = 3;

(This is also illegal, but it's caught as a parse error because we only allow an identifier on the left-hand side of an assignment:

$ActiveTasks.Count = 3;

)

Confusing error message on malformed double literal

When a string like 1.9.0 occurs within a function argument list, for example:

a = $ActiveTasks.GetSample(1.9.0)

it gives a parse error at the second dot, which is fine. But the error message is

Expected a token of one of the types DoubleLiteral, StringLiteral, Identifier,
but got token "." of type OperatorMemberSelect.

Why would the parser expect on of those at the point where I typed the second dot?

NRE when a method invocation is missing the closing paren

If you leave a method invocation unclosed, for example

a = $ActiveTasks.GetSample(1.9

the parser attempts to construct a MethodInvocationNode with the closeParen argument set to null. This gives a NullReferenceException when the argument closeParen.EndIndex is passed to the base class ctor.

If there is no closing paren, throw a parse exception instead of trying to construct the MethodInvocationNode.

DRY out rule test classes

The test methods in those classes all have the same structure.

We can't put the entire test method into a base class, because the test method is decorated with [MemberData("TestCases")], and Xunit insists that a member of that name exist on the base class. The best we can do is factor the bodies of the test methods into a common helper in the base class.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.