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

0.4.2 failing to parse variable interpolation in mutli line string #230

Open
tin-ot opened this issue Sep 19, 2024 · 2 comments
Open

0.4.2 failing to parse variable interpolation in mutli line string #230

tin-ot opened this issue Sep 19, 2024 · 2 comments

Comments

@tin-ot
Copy link

tin-ot commented Sep 19, 2024

Hello,

I am currently just trying to look into the project,

It seems that there is issues to parse bicep files with multi line strings

  • version :

pip freeze | grep pycep
pycep-parser==0.4.2

  • snippet

resource name 'Microsoft.Insights/scheduledQueryRules@2023-03-15-preview' = {

.....

    {
      query: format(
        '''l
  • error when parsing :

lark.exceptions.UnexpectedCharacters: No terminal matches ''' in the current parser context, at line 35 col 13

        '''
        
        
       ( I guess the failing character might be any of the character inside to querry for metrics )
@gruebel
Copy link
Owner

gruebel commented Sep 22, 2024

hey @tin-ot thanks for reaching out.

Did you try the preview releases? You can find them on pypi. If it works, then great. If not, then please provide a complete example, enough to reproduce it.

@tin-ot
Copy link
Author

tin-ot commented Oct 17, 2024

  1. Indeed I started by trying the latest Pypi version
    Ans it is failing as well

The issue is not a specific character more the interpolation in the multiline that is failing to be parsed

here are the version

pip freeze | grep pycep
pycep==1.0.4
pycep-parser==0.4.2

Here are steps to reproduce :

created bicep file will a structure of a Microsoft.Insights/scheduledQueryRules

Then :

Multi line query OK

resource myalert 'Microsoft.Insights/scheduledQueryRules@2023-03-15-preview' = {
......
      allOf: [
        {
          query: '''AzureDiagnostics
          my multiline
          query without any variable
          '''
       .....

Multi line query NOK

resource myalert  'Microsoft.Insights/scheduledQueryRules@2023-03-15-preview' = {
......
      allOf: [
        {
          query: format(
          '''AzureDiagnostics
          my multilin
          query with {0} ''', myvariable
         )

       .....

Hope this help !

By the way I don't if it is supposed to be supported but looks like this function :
cidrSubnet( )
https://learn.microsoft.com/en-us/azure/azure-resource-manager/bicep/bicep-functions-cidr#cidrsubnet
is breaking parser as well

@tin-ot tin-ot changed the title 0.4.2 failing to parse mutli line string 0.4.2 failing to parse variable interpolation in mutli line string Oct 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants