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

Support older R versions #828

Merged
merged 13 commits into from
Jun 2, 2024
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/full-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
fail-fast: false
matrix:
# currently we offer no official support for 3.x
Ellpeck marked this conversation as resolved.
Show resolved Hide resolved
r-version: [ '4.4.0', '4.3.2', '4.2.3', '4.0.0' ]
r-version: [ '4.4.0', '4.3.2', '4.2.3', '4.0.0', '3.6.3', '3.0.0', '2.15.3', '2.0.0', '1.9.1', '1.6.2' ]
os: [ ubuntu-latest ]
include:
- os: macos-latest
Expand Down
4 changes: 4 additions & 0 deletions src/r-bridge/lang-4.x/ast/model/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,10 @@ export const enum RawRType {
* https://github.com/REditorSupport/languageserver/pull/328
*/
ExprOfAssignOrHelp = 'expr_or_assign_or_help',
/**
* Pre-4.0 version of expr_or_assign_or_help, see {@link RawRType.ExprOfAssignOrHelp} documentation
Ellpeck marked this conversation as resolved.
Show resolved Hide resolved
*/
LegacyEqualAssign = 'equal_assign',
/** T65 */
ExpressionList = 'exprlist',
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { tryNormalizeSymbol } from '../values/normalize-symbol'
*/
export function tryNormalizeFunctionCall(data: NormalizerData, mappedWithName: NamedXmlBasedJson[]): RFunctionCall | RNext | RBreak | undefined {
const fnBase = mappedWithName[0]
if(fnBase.name !== RawRType.Expression && fnBase.name !== RawRType.ExprOfAssignOrHelp) {
if(fnBase.name !== RawRType.Expression && fnBase.name !== RawRType.ExprOfAssignOrHelp && fnBase.name !== RawRType.LegacyEqualAssign) {
parseLog.trace(`expected function call name to be wrapped an expression, yet received ${fnBase.name}`)
return undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function tryNormalizeFor(
return undefined
} else if(head.name !== RawRType.ForCondition) {
throw new XmlParseError(`expected condition for for-loop but found ${JSON.stringify(head)}`)
} else if(body.name !== RawRType.Expression && body.name !== RawRType.ExprOfAssignOrHelp) {
} else if(body.name !== RawRType.Expression && body.name !== RawRType.ExprOfAssignOrHelp && body.name !== RawRType.LegacyEqualAssign) {
throw new XmlParseError(`expected expr body for for-loop but found ${JSON.stringify(body)}`)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ export function tryNormalizeAccess(data: NormalizerData, mappedWithName: NamedXm
}

const accessed = mappedWithName[0]
if(accessed.name !== RawRType.Expression && accessed.name !== RawRType.ExprOfAssignOrHelp) {
if(accessed.name !== RawRType.Expression && accessed.name !== RawRType.ExprOfAssignOrHelp && accessed.name !== RawRType.LegacyEqualAssign) {
parseLog.trace(`expected accessed element to be wrapped an expression, yet received ${accessed.name}`)
return undefined
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ function splitExprs(tokens: readonly NamedXmlBasedJson[]) {
lastExpr = false
last = i + 1
} else {
const thisExpr = token.name === RawRType.Expression || token.name === RawRType.ExprOfAssignOrHelp
const thisExpr = token.name === RawRType.Expression || token.name === RawRType.ExprOfAssignOrHelp || token.name === RawRType.LegacyEqualAssign
if(thisExpr && lastExpr) {
if(i > last) {
segments.push(tokens.slice(last, i))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ export function normalizeSingleNode(data: NormalizerData, elem: NamedXmlBasedJso
case RawRType.ExpressionList:
case RawRType.Expression:
case RawRType.ExprOfAssignOrHelp:
case RawRType.LegacyEqualAssign:
return normalizeExpression(data, elem.content)
case RawRType.NumericConst:
return normalizeNumber(data, elem.content)
Expand Down
Loading