def p_scalar(p):
    """scalar : class_constant
              | common_scalar
              | QUOTE encaps_list QUOTE
              | STRING QUOTE encaps_list QUOTE
              | scalar_heredoc
              | nowdoc
              | class_name_constant"""
    if len(p) == 4:
        p[0] = p[2]
    elif len(p) == 5:
        if p[1] == 'b':
            p[0] = p[3]
    else:
        p[0] = p[1]
