Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remaining Scripting Tasks #111

Open
20 of 22 tasks
freezy opened this issue Oct 23, 2019 · 1 comment
Open
20 of 22 tasks

Remaining Scripting Tasks #111

freezy opened this issue Oct 23, 2019 · 1 comment
Assignees
Labels
scripting Related to the VBScript port
Milestone

Comments

@freezy
Copy link
Member

freezy commented Oct 23, 2019

  • Multiple Statements in one line using colons are not treated like block statements:

Currently:

If Err Then MsgBox "Can't open ""core.vbs""" : Exit Sub

renders:

    if (Err)
        MsgBox('Can\'t open "core.vbs"');
    return;

This was fixed in scripting/ebnf and merged into master.


  • Check how OR should be rendered.

Currently:

If VPBuildVersion < 0 Or Err Then
   x = 5 
End If

renders:

if (VPBuildVersion < 0 | Err) {
    x = 5;
}

This was fixed in scripting/ebnf as a logical or expression (||) and merged into master.


  • Implement classes and properties: ClassDecl, MemberDeclList, MemberDecl, PropertyDecl, and PropertyAccessType

JavaScript has classes but does not support fields.

Classes were implemented in scripting/ebnf and merged into master. ProperyDecl's were implemented as methods.


  • Properly support array vs call. For example:
   Controller.Switch(swLRFlip) = True

should probably render in JavaScript:

   Controller.Switch[swLRFlip] = true;

Do we need to make a second pass, to grab a collection of all variables in relation to their position on the stack. If we find a subcall that matches a variable name, switch statement to array

This was implemented in scripting/ebnf and merged into master.
result(0, 0, 0) = 42 --> _scope.result[0][0][0] = 42


  • Replace Id that might match JavaScript keywords.

For example, does Switch cause issues?

You could do a second pass, and all identifiers that match keywords, auto append something

or

maybe it can altered directly in the id helper post processor?

No updates were made as this does not seem to be an issue.


  • Correctly implement ByRef & ByVal.

Currently these are just ignored. In JavaScript, only objects are passed by reference


  • Redim needs to be fixed. Redim does not first require a Dim. Should we make a second pass and look for any previous Dim or additional Redim and change to assignment statements.

Currently:

Redim x(5, 5) 
Redim Preserve x(5, 10) 

renders:

let x = vbsHelper.redim(x, [
    5,
    5
]);
let x = vbsHelper.redim(x, [
    5,
    10
], true);

And would fail with:

Identifier 'x' has already been declared

This was implemented in scripting/ebnf and merged into master.
redim is no longer implemented as variable declaration.


  • Fields need to be really implemented Default, Erase, Error, Explicit, Step, Private, Public

These were implemented in scripting/ebnf and merged into master.
Step is a keyword in Visual Basic, but not VBScript. Option Explicit is ignored and only allowed as first line in program. Erase has been implemented as a dim`


  • Error statements need to be really implemented

Currently they are just rendered as comments:

;    // On Error Resume Next

**This was implemented in scripting/ebnf and merged into master.


  • Special character will break the parser

Currently WPC.vbs contains 0x93 and 0x94 in a comment:

'Everytime you press the flipper keys those switches are <93>on<94>,

This was implemented in scripting/ebnf and merged into master. The parser is now based on node-ebnf. The program is first parsed into tokens (as per microsoft docs), formatted, and then standardized.


  • Sometimes whitespace will lock up the parser

Example:

a.b(1).c(2) (3).d(4, 5)

should render as:

a.b(1).c(2, 3).d(4, 5)

This was implemented in scripting/ebnf and merged into master. Related to above, after the script if formatted and standardized, no extra whitespace is present.


  • Currently implement Nothing vs Null vs Empty literals.

Currently all are rendered as null

This was implemented in scripting/ebnf and merged into master. Nothing, Null, and Empty now have __stdlib members that represent null and undefined.


  • Implement 3 remaining SubCallStmt in grammar, and determine how SubSafeExprOpt is meant to be used
                     | QualifiedID _ IndexOrParamsList %dot LeftExprTail _ SubSafeExprOpt _ CommaExprList                                {% ppSubCall.stmt6 %}
                     | QualifiedID _ IndexOrParamsListDot LeftExprTail _ SubSafeExprOpt _ CommaExprList                                  {% ppSubCall.stmt7 %}
                     | QualifiedID _ IndexOrParamsList %dot LeftExprTail _ SubSafeExprOpt                                                {% ppSubCall.stmt8 %}
                     | QualifiedID _ IndexOrParamsListDot LeftExprTail _ SubSafeExprOpt                                                  {% ppSubCall.stmt9 %}

Need to confirm, but I believe IndexOrParamsListDot vs IndexOrParamsList %dot was intended to allow for whitespace a.b(1). c(2, 3)

This was fixed in scripting/ebnf and merged into master. Since the parser is now based on EBNF and microsoft specs, this is no longer relevant.


  • Finish LeftExpr and LeftExprTail

These are required for multiple object subcalls:

ExecuteGlobal fso.OpenTextFile("VPMKeys.vbs", 1).ReadAll

that renders as:

ExecuteGlobal(fso.OpenTextFile('VPMKeys.vbs', 1).ReadAll); 

ie, should ReadAll be ReadAll()?

This was fixed in scripting/ebnf and merged into master. Since the parser is now based on EBNF and microsoft specs, this is no longer relevant. See InvocationExpression and InvocationMemberAccessExpression


  • Implement CallStmt in grammar

This was fixed in scripting/ebnf and merged into master.


  • Fix Date literal. This may require a vbsHelper function because according to

http://www.herongyang.com/VBScript/Data-Type-Date-and-Time-Data-Literal.html

You can just do a time portion: #21:26:00#

**This was fixed in scripting/ebnf and merged into master. Since the parser is now based on microsoft specs, the date grammar is accurate. **


  • Determine what KeywordID and SafeKeywordID in the Rosetta Code grammar is trying to do

This was fixed in scripting/ebnf and merged into master. Since the parser is now based on EBNF and microsoft specs, this is no longer relevant.


  • Implement Imp logical implication function. This will need to be done as a vbsHelper as javascript does not have this built in:

https://www.promotic.eu/en/pmdoc/ScriptLangs/VBScript/Operat/Imp.htm


  • Find test cases for the following post processor helpers:
arg1
leftExpr1
leftExprTail1
qualifiedId2
indexOrParamsDot2
indexOrParamsDot4

This was fixed in scripting/ebnf and merged into master. Since the parser is now based on EBNF and microsoft specs, this is no longer relevant.


  • Add a test case for white space line continuation
vpmSystemHelp = "Zaccaria keys:" & vbNewLine &_
  vpmKeyName(keyInsertCoin1) & vbTab & "Insert Coin #1"   & vbNewLine &_
  vpmKeyName(keyInsertCoin2) & vbTab & "Insert Coin #2"   & vbNewLine &_
  vpmKeyName(keySelfTest)    & vbTab & "Open Coin Door"   & vbNewLine &_
  vpmKeyName(keyAdvance)     & vbTab & "Advance Test"

renders as:

vpmSystemHelp = 'Zaccaria keys:' + vbNewLine + vpmKeyName(keyInsertCoin1) + vbTab + 'Insert Coin #1' + vbNewLine + vpmKeyName(keyInsertCoin2) + vbTab + 'Insert Coin #2' + vbNewLine + vpmKeyName(keySelfTest) + vbTab + 'Open Coin Door' + vbNewLine + vpmKeyName(keyAdvance) + vbTab + 'Advance Test';

This was fixed in scripting/ebnf and merged into master. Since the parser first formats the script all line continuations merged into one line.


  • Check what NOT does on integer literals.

Do we need to implement ~ in certain cases?

This was fixed in scripting/ebnf and merged into master. Not was implemented as !


  • Fix lockup during the following:
If aNo < mSize Then mKick(aNo + 1).Kick 0, 0

This was fixed in scripting/ebnf and merged into master. Since the parser is now EBNF based, this is no longer an issue.

@freezy freezy added the scripting Related to the VBScript port label Oct 23, 2019
@freezy freezy added this to the Example Table milestone Oct 23, 2019
@jsm174 jsm174 self-assigned this Oct 31, 2019
@jsm174
Copy link
Contributor

jsm174 commented Jan 10, 2020

Updated initial comment.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
scripting Related to the VBScript port
Projects
None yet
Development

No branches or pull requests

2 participants