Question

What are the legal names for a smali label?

I know a-z and _ is legal and \n isn't obviously, but are there any rules regarding the label names?

I know the bytecode doesn't use the labels and the dalvik assembler (smali) converts it to position in the file, so it shouldn't really matter, but what would smali accept as a label name?

Was it helpful?

Solution

Smali uses the same set of characters for label names as for any other identifier. The valid characters are defined in the SimpleName section of the dex specification.

SimpleName → SimpleNameChar (SimpleNameChar)*
SimpleNameChar →
    'A' … 'Z'
  | 'a' … 'z'
  | '0' … '9'
  | '$'
  | '-'
  | '_'
  | U+00a1 … U+1fff
  | U+2010 … U+2027
  | U+2030 … U+d7ff
  | U+e000 … U+ffef
  | U+10000 … U+10ffff
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top