v icon indicating copy to clipboard operation
v copied to clipboard

vweb: unable to serve index.html with $type=\

Open Dialga opened this issue 5 years ago • 10 comments

V version: latest OS: Arch Linux x64

What did you do? Tried to use vweb to serve index.html from tiddlywiki.com.

What did you expect to see? vweb to compile

What did you see instead? internal_memory:4738:887143: error: invalid character `\`

Dialga avatar Nov 19 '20 09:11 Dialga

testcase:

// index.html
$type=\

//fail.v
import vweb
fn(mut a A) index() {
  $vweb.html()
}

Dialga avatar Nov 20 '20 10:11 Dialga

Probably the cause of this problem is that type is a reserved word

zakuro9715 avatar Nov 21 '20 04:11 zakuro9715

https://github.com/vlang/v/blob/650cdef8b406955ec4d3d24853b49663a3a209a4/vlib/v/scanner/scanner.v#L712

$type is scanned into $ key_type

zakuro9715 avatar Nov 21 '20 05:11 zakuro9715

I don't understand, why is it scanning .html for v code?

Dialga avatar Nov 21 '20 08:11 Dialga

$type is translated to v code at compile time

https://github.com/vlang/v/blob/650cdef8b406955ec4d3d24853b49663a3a209a4/vlib/v/parser/comptime.v#L47-L114

zakuro9715 avatar Nov 21 '20 08:11 zakuro9715

Hi @Dialga ,

can you confirm that the problem still exists on a fresh V (0.2.4)?

ArtemkaKun avatar Feb 10 '22 15:02 ArtemkaKun

Still broken for me:

internal_memory:18:1: error: unfinished string literal
internal_memory:12:1: details: literal started here

Dialga avatar Feb 11 '22 15:02 Dialga

Is this issue still present @Dialga ?

vexy avatar Jan 28 '23 00:01 vexy

Try changing to typ instead of type. Or almost anything other than type, really.

JalonSolov avatar Jan 28 '23 01:01 JalonSolov

Still failing in: V 0.4.7 b947750

esquerbatua avatar Sep 27 '24 00:09 esquerbatua

@spytheman I think this should be closed

Avey777 avatar Apr 01 '25 13:04 Avey777

Closing. vweb is deprecated. If the same error happens with veb, please open a new issue.

JalonSolov avatar May 19 '25 23:05 JalonSolov