Skip to content

Commit

Permalink
Treat '@{' an error instead of text in LG
Browse files Browse the repository at this point in the history
  • Loading branch information
Danieladu committed Feb 26, 2020
1 parent 25b1b53 commit 22b7572
Show file tree
Hide file tree
Showing 6 changed files with 129 additions and 118 deletions.
2 changes: 1 addition & 1 deletion libraries/botbuilder-lg/src/LGFileLexer.g4
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ fragment STRING_LITERAL : ('\'' (~['\r\n])* '\'') | ('"' (~["\r\n])* '"');
fragment STRING_INTERPOLATION : '`' ('\\`' | ~'`')* '`';
fragment EXPRESSION_FRAGMENT : '$' '{' (STRING_LITERAL|STRING_INTERPOLATION|EMPTY_OBJECT|~[\r\n{}'"`])*? '}';
fragment EXPRESSION_FRAGMENT : '$' '{' (STRING_LITERAL | STRING_INTERPOLATION | EMPTY_OBJECT | ~[\r\n{}'"`] )+ '}'?;
fragment ESCAPE_CHARACTER_FRAGMENT : '\\' ~[\r\n]?;
Expand Down
4 changes: 2 additions & 2 deletions libraries/botbuilder-lg/src/evaluator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ export class Evaluator extends AbstractParseTreeVisitor<any> implements LGFilePa
private readonly strictMode: boolean;

// to support broswer, use look-ahead replace look-behind
// original:/(?<!\\)$\{((\'[^\'\r\n]*\')|(\"[^\"\r\n]*\")|(\`(\\\`|[^\`])*\`)|[^\r\n\{\}\'\"\`])*?\}/g;
public static readonly expressionRecognizeReverseRegex: RegExp = new RegExp(/\}((\'[^\'\r\n]*\')|(\"[^\"\r\n]*\")|(\`(\\\`|[^\`])*\`)|([^\r\n\{\}\'\"\`]))*?\{\$(?!\\)/g);
// original:/(?<!\\)$\{((\'[^\'\r\n]*\')|(\"[^\"\r\n]*\")|(\`(\\\`|[^\`])*\`)|[^\r\n\{\}\'\"\`])+\}?/g;
public static readonly expressionRecognizeReverseRegex: RegExp = new RegExp(/\}?((\'[^\'\r\n]*\')|(\"[^\"\r\n]*\")|(\`(\\\`|[^\`])*\`)|([^\r\n\{\}\'\"\`]))+\{\$(?!\\)/g);

public static readonly LGType = 'lgType';
public static readonly activityAttachmentFunctionName = 'ActivityAttachment';
Expand Down
Loading

0 comments on commit 22b7572

Please sign in to comment.